Topic 8 - Exercise 10
1. Find definitions for eight terms and concepts used in threaded programming:
Thread Synchronization - Thread synchronization requires that a running thread gain a "lock" on an object before it can access it. The thread will wait in line for another thread that is using the method/data member to be done with it. This is very important to prevent the corruption of program data if multiple threads will be accessing the same data. If two threads try to change a variable or execute the same method at the same, this can cause serious and difficult to find problems. Thread synchronization helps prevent this.
Locks - A lock is a synchronization mechanism for enforcing limits on access to a resource in an environment where there are many threads of execution. Locks are one way of enforcing concurrency control policies.
Deadlock - In computer science,deadlock refers to a specific condition when two or more processes are each waiting for each other to release a resource, or more than two processes are waiting for resources.
Semaphores - a semaphore is a protected variable or abstract data type that constitutes a classic method of controlling access by several processes to a common resource in a parallel programming environment. A semaphore generally takes one of two forms: binary and counting. A binary semaphore is a simple "true/false" (locked/unlocked) flag that controls access to a single resource. A counting semaphore is a counter for a set of available resources.
Mutex - Mutual exclusion (often abbreviated to mutex) algorithms are used in concurrent programming to avoid the simultaneous use of a common resource, such as a global variable, by pieces of computer code called critical sections. A critical section is a piece of code in which a process or thread accesses a common resource. The critical section by itself is not a mechanism or algorithm for mutual exclusion. A program, process, or thread can have the critical section in it without any mechanism or algorithm which implements mutual exclusion.
Thread - a thread results from a fork of a computer program into two or more concurrently running tasks. The implementation of threads and processes differs from one operating system to another, but in most cases, a thread is contained inside a process. Multiple threads can exist within the same process and share resources such as memory, while different processes do not share these resources.
Event - in programming world even can refer to an action which invokes certain event that is predetermined by that very action e.g. rolling a computer mouse pointer over a link to display w message.
Waitable timer - A waitable time is a synchronization object whose state is set to signaled when a specified due time arrives.
References:
http://en.wikipedia.org/wiki/Deadlock accessed on 22/10/2010
http://en.wikipedia.org/wiki/Thread_(computer_science) accessed on 19/05/2010
http://en.wikipedia.org/wiki/Semaphore_(programming) accessed on 22/05/2010
No comments:
Post a Comment