Monday, May 11, 2009

Exercise 17: Concurrency terms

Find definitions for eight terms and concepts used in threaded programming:

1. Thread Synchronisation

Daelin stated that thread synchronization helps to prevent the threads created to change the value of a variable at the same time. A 'lock' is applied for the process which gain the right to use the variable. The other thread will wait till the 'lock' applied on the variable to release. In multiple threads environment, it is used to prevent the corruption of program data.

2. Locks

There are two types of lock, read and write lock. It is used to ensuring only one thread can access the resource at a time to prevent conflict. (Ince)

3. Deadlock

According to Ince (2004), deadlock is defined as "where two threads cannot proceed becuse each is holding resources required by the other."

4. Semaphores

"A semaphore is a protected variable or abstract data type which constitutes the classic method for restricting access to shared resources such as shared memory in a multiprogramming environment." (Wikipedia)

5. Mutex (mutual exclusion)

Galvin (1994) defined that mutual exclusion condition exists "If process Pi is executing in its critical section, then no other processes can be executing in their critical section."

6. Thread

Ince (2004) stated that thread is "An independent execution of some program code."

7. Event

The Microsoft Developer Network stated that event is "Represents the state of an event, such as the element in which the event occurred, the state of the keyboard keys, the location of the mouse, and the state of the mouse buttons."

8. Waitable timer.

In Microsoft Developer Network, it defined waitable timer as "a waitable timer object is a synchronization object whose state is set to signaled when the specified due time arrives."

It also stated that there are three types of timer - manual-reset, synchronization and periodic timer and is defined in MSDN as follows.

"manual-reset timer - A timer whose state remains signaled until SetWaitableTimer is called to establish a new due time.

synchronization timer - A timer whose state remains signaled until a thread completes a wait operation on the timer object.

periodic timer - A timer that is reactivated each time the specified period expires, until the timer is reset or canceled. A periodic timer is either a periodic manual-reset timer or a periodic synchronization timer."

Reference:
Galvin, S. (1994), Operating System Concepts 4ed, Addison Wesley

Ince, D. (2004), Developing distributed and e-commerce applications 2nd edition, Pearson education limited

Microsoft Developer Network (n.d.), event Object, Retrieved 11 May 2009 from http://msdn.microsoft.com/en-us/library/ms535863(VS.85).aspx

Wikipedia (n.d.), Semaphore (programming), Retrieved 11 May 2009 from http://en.wikipedia.org/wiki/Semaphores

WikiAnswer (n.d.), What is Thread Synchronization?, Retrieved 12 May 2009 from http://wiki.answers.com/Q/What_is_Thread_Synchronization

No comments:

Post a Comment