Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site lsuc.UUCP Path: utzoo!lsuc!dave From: dave@lsuc.UUCP (David Sherman) Newsgroups: net.unix-wizards Subject: Re: sticky bits ? Message-ID: <426@lsuc.UUCP> Date: Mon, 18-Feb-85 21:11:56 EST Article-I.D.: lsuc.426 Posted: Mon Feb 18 21:11:56 1985 Date-Received: Mon, 18-Feb-85 22:28:03 EST References: <344@byucsa.UUCP> Reply-To: dave@lsuc.UUCP (David Sherman) Distribution: net Organization: Law Society of Upper Canada, Toronto Lines: 45 Summary: tutorial on shared-text and sticky bitting OK, time for tutorial (well, a monologue) on shared-text and sticky-bitting. Every process takes up space in memory. Part of this space is "text" and part is "data". ("Text" is, roughly, the machine instructions, and "data" is the space for user variables.) If you have processes which many users run at the same time (e.g., a shell or editor), then you can have all users run out of the same text space and avoid using up lots of memory, by using the "shared-text" feature of UNIX. To get this, compile with "cc -n". To look for it, run file(1) and look for the word "pure", as in "pure executable". To find out the relative text and data sizes of your executable, run size(1). The number of shared-text programs which can be running at one time is limited by the system, since it needs to check all processes against a table when they are started up. This is the system parameter NTEXT. If you run out, you'll get an "Out of text" on the console, but the system should not crash. Once you're running shared-text, there's a further optimization you can do. That is sticky-bitting. You do it by turning on the 01000 bit with chmod (in plainer language, with "chmod 1755 file"). You see it as "rwxr-xr-xt" (V6) or "rwxr-xr-t" (V7) with ls -l. The effect of sticky-bitting is described quite well in chmod(2): " mode 1000 prevents the system from abandoning the swap-space image of the program-text portion of the file when its last user terminates. Thus when the next user of the file executes it, the text need not be read from the file system but can simply be swapped in, saving time. " The usefulness of these features depends in part on your application. If you have lots and lots of memory, they won't make too much difference. In our application, we can have 30 students at a time running the same 100K program on a machine with only 1 Meg of memory, so it's pretty important. The above description applies to V6 and V7, and to later derivatives as far as I know. If you found it useful, please let me know. Dave Sherman -- {utzoo pesnta nrcaero utcs}!lsuc!dave {allegra decvax ihnp4 linus}!utcsri!lsuc!dave