[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Number of Procs



Darac Marjal writes:
 > >  > One process will be given some time on a processor and then, after
 > >  > a period of time or when that process yields control of the
 > >  > processor
 > > 
 > > Is not the process that yelds, it's the kernel that assigns the CPU to
 > > another process, as you correctly explain below.
 > 
 > I thought that both mechanisms were available? That is, a process could
 > voluntarily say "I don't need the CPU at the moment"? Or is it simply
 > the fact that the process ISN'T using the CPU that causes it to get
 > pre-empted?

A process automatically says "I do  not need the CPU" whenever does an
action that can not be completed until some event happens (all kind of
I/O for example, the process can not go ahead until the data arrives).

If the process has all the resources  he needs the best thing to do is
let it run as fast as  possible until its timeslice expires, after all
we built  computers to get the  solutions as fast as  they can compute
them, the faster the better :).

As far as I know a sched_yield() call is available for threads - not
processes - and an uncareful use of this call "could result in
unnecessary context switches, which will degrade system performance.

-- 
 /\           ___                                    Ubuntu: ancient
/___/\_|_|\_|__|___Gian Uberto Lauri_____               African word
  //--\| | \|  |   Integralista GNUslamico            meaning "I can
\/                 coltivatore diretto di software       not install
     già sistemista a tempo (altrui) perso...                Debian"

Warning: gnome-config-daemon considered more dangerous than GOTO


Reply to: