Answer to: What is a kernel?

John S Gwynne jsg
Thu Oct 27 15:56:19 GMT 1994


--------

I'm forwarding this from: Steve=Ravet%Prj=Eng%PCPD=Hou at bangate.compaq.com
  --jsg

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
 lusky at knuth.mtsu.edu (Jonathan R. Lusky) Wrote:
 | 
 | 
 | John S Gwynne writes:
 | > hardware. By the use of semaphores, the resource of an ADC can 
 | be
 | > allocated to the coolant measurement task, air temp measurement 
 | task, O2
 | > sensor measurement task, etc. All of which can run at different 
 | rates and be
 | > unaware of the others. Bottom line: a large problem like EFI 
 | can be broken up
 | > into several smaller tasks that may only need a few lines of 
 | C-code!
 | > 
 | > It's an alternative to writing one long "loop" of software that 
 | must keep
 | > track of timing and on which loops to measure what and when to 
 | do this or
 | > that. The kernel will do all that for you. Ok... It's a 
 | luxury... :)
 | 
 | I'm taking Operating Systems right now, just went over semaphores a few
 | weeks ago.  We were "told" that semaphore operations (P & V) are pretty
 | expensive respect to cpu cycles.  Is that a problem in the real world,
 | or is it insiginificant compred to the number of spare CPU cycles
 | we've got nowadays (with respect to EFI controllers :)?
 | 
 | 
 
 Semaphore operations on modern processors are not expensive, since
 they are a single instruction.  on x86 architecture, a semaphore is:
 
 	lock	btr	x,y
 
 where x is the semaphore, y is the bit number.  The key is that it
 has to be a single locked instruction (note the lock prefix).  That
 way a context switch cannot happen while you are trying to grab the
 semaphore.  Note that this also safe for multiple processor systems.
 There is an algorithm to implement semaphores on processors that do
 not support a locked instruction for test/reset.  It involves an array
 of semaphores that you have to loop through.  Now that is expensive.
 Of course, waiting on a locked semaphore is also expensive, but that
 doesn't really count.
 
 What I don't understand is where the names for 'p' and 'v' came from....
 
 --steve
 



More information about the Diy_efi mailing list