Thread View: comp.unix.wizards
3 messages
3 total messages
Started by Bernard Fouche
Wed, 27 Jan 1993 19:53
How to avoid calling time(2)
Author: Bernard Fouche
Date: Wed, 27 Jan 1993 19:53
Date: Wed, 27 Jan 1993 19:53
29 lines
1544 bytes
1544 bytes
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. 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 :-) Or am I going the wrong way because the time(2) system call is so light that I should try to find other means to reduce the impact of my applications on the system ? Any comment or hint welcome ! Thank you ! -- -------------------------------------------------------------------------- Bernard Fouche VOX : +(33) (1) 48.04.56.30 FAX : (33) (1) 48.04.98.95 Email : bernard@cpio1.fr.mugnet.org Postal Mail : CPIO S.A., 13-15 Rue de la Verrerie, 75004 Paris, France
Re: How to avoid calling time(2)
Author: Gord Cody
Date: Thu, 28 Jan 1993 13:26
Date: Thu, 28 Jan 1993 13:26
31 lines
1831 bytes
1831 bytes
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 }
Re: How to avoid calling time(2)
Author: Arlie Davis
Date: Thu, 28 Jan 1993 15:41
Date: Thu, 28 Jan 1993 15:41
13 lines
1164 bytes
1164 bytes
gcody@gandalf.ca (Gord Cody) writes: > 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 :) You're kidding, right? -- lrwx------ 1 aldavi01 emacsstu 9 Jun 6 12:43 .signature -> /dev/null
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads