home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / unix / wizards / 5679 < prev    next >
Encoding:
Text File  |  1993-01-28  |  1.7 KB  |  42 lines

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