[comp.os.mach] Synchronization in MACH

vijay@nixdorf2.osf.org (Vijay Kumar) (02/19/91)

Hi,

Recently I was reading an article about MACH and I noticed that MACH
doesn't provide
an synchronization mechanism between threads like semaphores on System
V. The only
synchronization mechanism provided is via MACH IPC and threads have to
implement
their own ways of synchronization perhaps using thread scheduling
facilities like:
thread_suspend(), thread_wait() and thread_resume(). Does someone know
exactly why
semaphores are not supported in MACH? There's some good reason, I hope. 

For designing databases which heavily depend on synchronization
mechanisms provided
by the underlying os, it would be really helpful.

Vijay

Rick.Rashid@cs.cmu.edu (02/19/91)

The CThreads package provides mutex lock and unlock
operations, condition signal and condition broadcast.
Documentation on CThreads is available from CMU
as part of our Mach releases.   I'm, not really
certain why this was not mentioned in the article
you read unless something else was being discussed
other than cross-thread synchronization.  

-Rick

velasco@beowulf.ucsd.edu (Gabriel Velasco) (02/22/91)

vijay@nixdorf2.osf.org (Vijay Kumar) writes:

>Recently I was reading an article about MACH and I noticed that MACH
>doesn't provide an synchronization mechanism between threads like
>semaphores on System V. The only synchronization mechanism provided is
>via MACH IPC and threads have to implement their own ways of
>synchronization perhaps using thread scheduling facilities like:
>thread_suspend(), thread_wait() and thread_resume(). Does someone know
>exactly why semaphores are not supported in MACH? There's some good
>reason, I hope.

From the paper _Mach Threads and the Unix Kernal: The Battle for
Control_ by Avadis Tevanian, Jr., Richard F. Rashid, David B. Golub,
David L. Black, Eric Cooper and Michael W. Young from the Department of
Computer Science at Carnegie-Mellon University:

	The Mach kernel does not enforce a synchronization model.
	Instead, it provides basic primitives upon which different
	models of synchronization may be built.  One form such
	synchronization could take would be the Mach IPC facility...
	Should an application desire its own thread-level
	syncrhonization, it can use the suspend, resume and wait
	primitives...

	Of course, the kernel could implement semaphores directly (as
	does, for example, System V).  It was felt, however, that a
	semaphore package would only add yet another synchronization
	mechanism to the kernel on top of that provided by the Mach IPC
	facility.  The kernel would inevitable implement only a small
	set of semaphore types and applications that wanted to use
	different semaphore semantics would still be forced to use an
	extra layer of synchronization and manage additional data
	structures.

From a book on operating systems:

	Mach provides primitives from which synchronization tools can
	be built.  This is consistent with Mach's philosophy of
	providing minimum yet sufficient functionality in ther kernel.
	The Mach IPC facility can be used for synchroniztion...

	The IPC mechanism is very flexible, and is used throughout
	Mach.  For example, it may be used for thread
	synchronization...

In general, they wanted to provide a very simple kernel with a small
number of abstractions that would be sufficient to implement other
operating systems.


-- 
                              ________________________________________________
 <>___,     /             /  | ... and he called out and said, "Gabriel, give |
 /___/ __  / _  __  ' _  /   | this man an understanding of the vision."      |
/\__/\(_/\/__)\/ (_/_(/_/|_  |_______________________________________Dan_8:16_|