Abstract
The complexities of parallel processing introduce the problem that generally leads to complex interprocess communications. With packetC, the notion of global data is ever-present and even though access to data elements is atomic, programs represent information in more complex structures than basic scalar types. As such, a mechanism for communication with other contexts is required in order to notify them to not touch portions of global memory that are in use, or more important, being manipulated by another context. Locking of memory can grind a parallel system to a halt. So, instead, packetC introduces a method of semaphores where any global int data element can be used as a semaphore representing whatever the application desires. It is a cooperative inter-process memory protection model that trades off some security in return for significant performance. Lock and unlock methods are applicable to global data elements which provide an atomic test-and-set, storing a magic number in the data element itself. Should the lock be successful, the application can proceed to work on other data elements safely, knowing it is not in competition.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Rights and permissions
Copyright information
© 2011 CloudShield Technologies, Inc. An SAIC Company
About this chapter
Cite this chapter
Jungck, P., Duncan, R., Mulcahy, D. (2011). Semaphores in packetC. In: packetC Programming. Apress. https://doi.org/10.1007/978-1-4302-4159-1_17
Download citation
DOI: https://doi.org/10.1007/978-1-4302-4159-1_17
Publisher Name: Apress
Print ISBN: 978-1-4302-4158-4
Online ISBN: 978-1-4302-4159-1
eBook Packages: Professional and Applied ComputingProfessional and Applied Computing (R0)Apress Access Books