CSC 456 Fall 2013/7a ac: Difference between revisions
Line 40: | Line 40: | ||
==Supported Synchronization in Different Languages== | ==Supported Synchronization in Different Languages== | ||
{|class="wikitable | The following table shows different programming languages and their support for various synchronization methods. The cells are color coded based on the following key: | ||
{|class="wikitable" | |||
|+ Supported Operating Systems Key | |||
|'''None''' | |||
|style="background:#0000ff;color:white"|'''Windows Only''' | |||
|style="background:#00ff00"|'''Mac Only''' | |||
|style="background:#ff0000;color:white"|'''Linux Only''' | |||
|style="background:#00ffff"|'''Windows & Mac''' | |||
|style="background:#ff00ff;color:white"|'''Windows & Linux''' | |||
|style="background:#ffff00"|'''Mac & Linux''' | |||
|style="background:#000000;color:#ffffff"|'''All''' | |||
|} | |||
{|class="wikitable" | |||
|+ Synchronization Support | |+ Synchronization Support | ||
!Language !! Semaphore/Mutex !! Monitor !! OpenMP !! Synchronized !! Other | !Language !! Semaphore/Mutex !! Monitor !! OpenMP !! Synchronized !! Other | ||
|- | |- | ||
| | |C | ||
|style="background:#000000"| | |style="background:#000000"| | ||
|style="background:#000000"| | |style="background:#000000"| | ||
Line 51: | Line 65: | ||
| | | | ||
|- | |- | ||
| | |Java | ||
|style="background:#000000"| | |style="background:#000000"| | ||
|style="background:#000000"| | |style="background:#000000"| | ||
Line 58: | Line 72: | ||
| | | | ||
|- | |- | ||
| | |C++ | ||
|style="background:#000000"| | |style="background:#000000"| | ||
|style="background:#000000"| | |style="background:#000000"| | ||
Line 65: | Line 79: | ||
|Slim Rd/Wr Lock (SRW) | |Slim Rd/Wr Lock (SRW) | ||
|- | |- | ||
| | |C# | ||
|style="background:#000000"| | |style="background:#000000"| | ||
|style="background:#ff0000"| | |style="background:#ff0000"| | ||
Line 72: | Line 86: | ||
| | | | ||
|- | |- | ||
| | |Ruby | ||
|style="background:#000000"| | |style="background:#000000"| | ||
|style="background:#000000"| | |style="background:#000000"| | ||
Line 79: | Line 93: | ||
|Get Sources | |Get Sources | ||
|- | |- | ||
| | |Python | ||
|style="background:#000000"| | |style="background:#000000"| | ||
|style="background:#ffffff"| | |style="background:#ffffff"| | ||
Line 86: | Line 100: | ||
|Get Sources | |Get Sources | ||
|- | |- | ||
| | |PHP | ||
|style="background:#000000"| | |style="background:#000000"| | ||
|style="background:#ffffff"| | |style="background:#ffffff"| | ||
Line 93: | Line 107: | ||
|Get Sources | |Get Sources | ||
|- | |- | ||
| | |Fortran | ||
|style="background:#ffffff"| | |style="background:#ffffff"| | ||
|style="background:#ffffff"| | |style="background:#ffffff"| |
Revision as of 19:03, 12 November 2013
Survey of Primitives for Synchronization
Assignment
7a. Survey of primitives for synchronization Section 7.3 of Solihin covers the need for synchronization at the program level. It mentions lock and unlock operations. But real programs do not usually call lock and unlock mechanisms. Instead, they use higher-level operations, such as Java’s synchronized statement, or Open MP pragmas. Consider popular languages and common OSs such as Linux, MacOS, and Windows. How would programs do synchronization in these environments?
Ideas
synchronization constucts
syncs in clr semaphores in monitors (how many langs available in?)
Different Synchronization Constructs, languages that support them, general info.
Test-and-Set
Test-and-Test-and-Set
Lock-free
Array-lock
Semaphore-Java, C Acquire/Release the semaphore to enter the critical section. Only 1 thread can have the semaphore at a time.
Mutex-Java, C Like a binary semaphore, but with a few differences such as deletion safety (a process holding a mutex cannot be deleted).
Monitor-Java, C
Synchronized-Java
pragma-C (OpenMP)
a study of behavior of synchronization methods in commonly used languages and systems cederman et al.
Supported Synchronization in Different Languages
The following table shows different programming languages and their support for various synchronization methods. The cells are color coded based on the following key:
None | Windows Only | Mac Only | Linux Only | Windows & Mac | Windows & Linux | Mac & Linux | All |
Language | Semaphore/Mutex | Monitor | OpenMP | Synchronized | Other |
---|---|---|---|---|---|
C | |||||
Java | |||||
C++ | Slim Rd/Wr Lock (SRW) | ||||
C# | |||||
Ruby | Get Sources | ||||
Python | Get Sources | ||||
PHP | Get Sources | ||||
Fortran | Coarray<ref name=umdguide></ref> |