SCIENTIFIC-LINUX-USERS Archives

January 2017

SCIENTIFIC-LINUX-USERS@LISTSERV.FNAL.GOV

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
David Sommerseth <[log in to unmask]>
Reply To:
Date:
Wed, 4 Jan 2017 18:01:48 +0100
Content-Type:
text/plain
Parts/Attachments:
text/plain (45 lines)
On 04/01/17 05:54, jdow wrote:
>>
>>
>> Off the top of my head, dnsdomainname, domainname, nisdomainname,
>> ypdomainname are symlinks to hostname; halt, poweroff, reboot,
>> shutdown are symlinks to systemctl; view is a symlink to vi; etc.
> 
> I hadn't dug that far. But, again, it makes sense in a weird sort of
> way. It is really an ultimate reuse of code, right? {^_-}

In essence, yes.  IMO,there is often a misconception of the Unix
philosophy.  There is a good thought behind "a single program does a
single task, and does it well".  But that does not mean that each single
program must be a standalone binary, built from a standalone source code.

From a coding perspective, code re-use is absolutely something to strive
for.  If there is an issue in the shared code, you fix the bug once and
not across X various source files or standalone projects.

And there is no real reasons why not to have a shared code base for all
the code which is basically identical.

Of course you can compile a project with, say 20 functions which results
in 20 different binary files based on shared source code.  But that is
also inefficient as well.  Each of these binary files carry an overhead
of ELF information and so on.  On most harddrives today there is less to
worry about in regards to bytes spent, but if you are in the embedded
world where each byte spent matters - this gives another advantage.

Combining all these 20 functions into a single binary reduces that
overhead.  But in addition, the file system cache can cache a single
binary while providing 20 functions out of this single cache hit ...
which results in improved performance, especially if many of these
functions are used often.

But again, that these 20 functions comes from a shared binary and from a
shared source code does not imply that each of these functions does more
than one thing and that it doesn't do it well.


-- 
kind regards,

David Sommerseth

ATOM RSS1 RSS2