Re: OS / hardware support for Semphores



Divick wrote:
Hi, I have question related to semapores / lock. Does the OS / hardware
need to provide some support for Semaphores / locks? Why is it necessary?
Why can't it be implemented without the support of OS/ hardware?

Think about what a semaphore (or lock) has to do.

It must be at a higher level of abstraction than a process because it must
be shared by multiple processes. Thus the implementation cannot be as low as
a process. So it must be implemented at the OS or hardware level.

Now part of the implementation might be done at the level of individual
processes, but not much -- because operations on semaphores (or locks) must
be indivisible and process switching can occur anytime between the
individual instructions of a processor (assuming the processor is not
hyperthreaded or multi-core) and that the machine has only a single
processor. If the machine is multi-processor, multi-threaded, or
multi-cored, then there is no evading the need for hardware support in some
form or other.

--
.~. Jean-David Beyer Registered Linux User 85642.
/V\ PGP-Key: 9A2FC99A Registered Machine 241939.
/( )\ Shrewsbury, New Jersey http://counter.li.org
^^-^^ 05:55:01 up 1 day, 8:44, 3 users, load average: 4.33, 4.23, 4.13
.



Relevant Pages

  • OS / hardware support for Semphores
    ... I have question related to semapores / lock. ... Does the OS / hardware ... need to provide some support for Semaphores / locks? ... Why can't it be implemented without the support of OS/ ...
    (comp.os.linux.misc)
  • Re: OS / hardware support for Semphores
    ... need to provide some support for Semaphores / locks? ... Why can't it be implemented without the support of OS/ ... Is not google and, or wikipedia helpful? ...
    (comp.os.linux.misc)
  • Re: rt20 scheduling latency testcase and failure data
    ... The system was under heavy network load for some of the time, ... # Firmware Drivers ... # ACPI Support ... # ISDN4Linux hardware drivers ...
    (Linux-Kernel)
  • NMI watchdog doesnt know what hardware to touch
    ... NMI watchdog doesn't know what hardware to touch ... Linux 2.6.24-rc5-g4af75653 on x86_64 ... # SCSI support type ... # Input Device Drivers ...
    (Linux-Kernel)
  • Re: Linux 2.6.20-rc2
    ... corruption (either hardware or kernel induced) that could cause this. ... So my guess would still be memory corruption of some sort, ... # ACPI Support ...
    (Linux-Kernel)