home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.wizards
- Path: sparky!uunet!think.com!spool.mu.edu!torn!nott!hobbit.gandalf.ca!gcody
- From: gcody@gandalf.ca (Gord Cody)
- Subject: Re: How to avoid calling time(2)
- Message-ID: <1993Jan28.132632.1374@gandalf.ca>
- Organization: Gandalf Data Ltd.
- References: <1993Jan27.195309.15120@cpio1.fr.mugnet.org>
- Date: Thu, 28 Jan 1993 13:26:32 GMT
- Lines: 31
-
- In <1993Jan27.195309.15120@cpio1.fr.mugnet.org> bernard@cpio1.fr.mugnet.org (Bernard Fouche) writes:
-
- >Hi wizards!
-
- >I run many applications that need to call very often the time(2)
- >system call. I do not see how I could design my programs to do without
- >having to get the result of time(2) very ofen.
-
- >But I wonder if there is a way (on a 486 running Dell Unix 2.0 at
- >least) to get time information without having to do a system call each
- >time.
-
- Every time you do a system call you are giving UNIX a chance
- to swap your process.
-
- >For instance, does someone know if I can get a pointer toward the
- >value of time that is stored somewhere in the system ? Of course this
- >should work with processes having no suid bit set nor running as root
- >and files like /unix or /dev/kmem must stay to be not readable by
- >anyone :-)
-
- How about this. Each process attaches to a small shared memory
- segment when they start. 1 process has an alarm go off every
- second, it does the time() call and updates the shared memory.
- Whenever any other process requires the time, it simply uses the
- shared memory value. No setuid required, or running as root, or
- touching of /unix or /de/kmem required. Have a nice day :)
-
- Gord Cody - all opinions are MINE,MINE,MINE #$@%^#!##:^) gcody@gandalf.ca
- Gandalf Mobile Systems Inc. - the company has its own 613-723-6500 x 8817
- 2 Gurdwara Rd. Nepean Ont. Can. - #define th_th_th_thats_all_folks }
-