Relinquish CPU control

Relinquish CPU control

Post by Omer Azmo » Tue, 13 Oct 1998 04:00:00



On other operating systems, there is a system call that causes a reschdule
of processes -- declare significant event.  This allows a program to
willingly relinquish control of the CPU, without doing a sleep(). What this
command does is cause a immediate reschdule just as if sleep or some i/o
command with wait was called, however, it does not place the calling program
in a wait mode.  So if no one else is waiting or the CPU becomes free again
before a sleep() would expire, the program just goes on running.
What would be the equivalent in UNIX or specifically SCO Open Server 5?
Anybody know?

Omer Azmon

 
 
 

Relinquish CPU control

Post by Scott G. Hal » Tue, 13 Oct 1998 04:00:00



> On other operating systems, there is a system call that causes a reschdule
> of processes -- declare significant event.  This allows a program to
> willingly relinquish control of the CPU, without doing a sleep(). What this
> command does is cause a immediate reschdule just as if sleep or some i/o
> command with wait was called, however, it does not place the calling program
> in a wait mode.  So if no one else is waiting or the CPU becomes free again
> before a sleep() would expire, the program just goes on running.
> What would be the equivalent in UNIX or specifically SCO Open Server 5?
> Anybody know?

UNIX is a pre-emptive multitasking operating system.  Meaning, whether a
process gives up control or not, the process scheduler takes control away
and pages in a different process anyway.  Note, it is not deterministic-
preemptive -- that would be a realtime system.  Regular UNIX uses an aging
algorithm with priorities to determine what to run next.  That is why each
user perceives that his login shell is getting good response on the system
-- another process can't hog the system (unless the sysadmin sets it up to
do so).

UNIX doesn't need processes to be friendly with each other -- it is not
MS-Windows (and its touchy-feely liberal "we must be friends" system).  In
fact in UNIX, one process doesn't even have to have another running for it
to run.  It is up to the processes themselves to employ a IPC mechinism if
they need to cooperate and synchronize themselves.

--
Scott G. Hall
GTE Government Systems
North Carolina Systems Center


 
 
 

Relinquish CPU control

Post by Omer Azmo » Wed, 14 Oct 1998 04:00:00


Dear Scott,

Thank you for your reply.  However, the problem at hand is a real problem
that is occuring on a real UNIX system.  Process A (a known HOG) is holding
a semaphore lock on a resource and releases it every so often, so others may
have access to the resouce, it then turns around and regrabs the semaphore.
Placing a sleep between release and grab slows the process down too much.
Not placing a sleep often causes the situation where the HOG regrabs the
semaphore lock without any other waiting process having a chance to due so,
due to the fact the Process A never relinquishes the CPU control.
This situation is solved on VMS and RSX-11 systems by a system call known as
Declare Significant Event that forces a reschedule at that point.
I could not find a similar system call on SCO Unix.  The question is there
some other perscribe solution for the Unix environment that someone is aware
of.

 
 
 

Relinquish CPU control

Post by Dr. Michael Alber » Wed, 14 Oct 1998 04:00:00


Quote:> Thank you for your reply.  However, the problem at hand is a real problem
> that is occuring on a real UNIX system.  Process A (a known HOG) is holding
> a semaphore lock on a resource and releases it every so often, so others may

Here is something which might tickle your fancy.
  Let A and B be semaphors.

program HOG{                      | program piglet{
  forever{                        |    acquire mutex B
     acquire mutex A              |    acquire mutex A
     ActLikeHog()                 |    MyTurn()
     release mutex A              |    release mutex A
     acquire mutex B              |    release mutex B
     release mutex B              | }
  }                               |

Quote:}                                 |

Note that with POSIX style mutexs, when there is no piglet waiting,
HOG has almost zero overhead!  Not even a system call!!

Also take a look at semaphors.

Best wishes,
  Mike

 
 
 

1. Relinquishing CPU control

On other operating systems, there is a system call that causes a reschdule
of processes -- declare significant event.  This allows a program to
willingly relinquish control of the CPU, without doing a sleep(). What this
command does is cause a immediate reschdule just as if sleep or some i/o
command with wait was called, however, it does not place the calling program
in a wait mode.  So if no one else is waiting or the CPU becomes free again
before a sleep() would expire, the program just goes on running.
What would be the equivalent in UNIX or specifically SCO Open Server 5?
Anybody know?

2. 2 Questions on SCO 5

3. MBR-relinquish control back to Windows

4. Troubleshooting my NTP daemon!

5. Sun license manager...1%cpu...1%cpu...50%cpu50%cpu50%cpu....

6. Mosaic help !!!

7. Any way to cure crashed inodes which e2fsck relinquished[failed]?

8. Security holes in VGA setuid-root utils

9. kermit problem relinquishing access to port; need help

10. CPU temperature control

11. How to control multiple CPU's

12. cpu controls in driverfs?

13. control user 99-100% cpu time?