What are lightweight semaphores ?
Hi, I am working on semaphores but I am not able to understand that what are lightweight semaphores ?
Can some one tell me in detail that what are they or if some can give me a link ...Thanks in anticipation...regards... |
The term can have different meanings but usually it will mean it is a semaphore that does not trigger system calls when used.
The typical semaphores are prepared to work between different processes and hence of cause involve systemcalls. If you just synchronize inside one process you can do without. You might get semaphores which are lightweight on the system calls but heavyweight when blocking (busy wait to avoid systemcalls for sleeping). Typically the light semaphores will be used with userlevel threading (inside one OS process), then you can "emulate" sleeping by rescheduling a different thread, all without systemcalls. |
hi cracauer,
Can u be more specific.I understood most of what u have said but ..."just synchronize inside one process you can do without." what does this mean ...can u be more elaborate on this...Thanks a lot in anticipation ..regards... |
If you have pure userlevel threads that run inside one operating system process, then you can use sempahores that will work without any systemcalls.
You can still have semephores with no systemcalls if you have multiple OS-level threads, but then you need a busy-wait which will usually not be worth it. |
ok got it ..But for this I have to define my own structures of semaphore and probably own functions as well...isn't it...Thanks for showing interest by the way....
|
Well, if they are not supplied with your OS then you would have to build them on your own.
|
One more thing...I want to make light weight (in both memory and performance...) semaphores .Any suggestions how can I do that.Can I reduce the memory usage by defining my own semaphores ?
THanks in anticipation.. |
All times are GMT -5. The time now is 12:33 AM. |