Page 72 - DCAP403_Operating System
P. 72
Unit 4: Process Management
4.11 Threading Issues Notes
The threading issues are:
1. System calls form and exec is discussed here. In a multithreaded program environment,
form and exec system calls is changed. Unix system have two version of form system calls.
One call duplicates all threads and another that duplicates only the thread that invoke the
form system call whether to use one or two version of form system call totally depends
upon the application. Duplicating all threads in unnecessary if exec is called immediately
after form system call.
2. Thread cancellation is a process of thread terminate before its completion of task.
Example: In multiple thread environment thread concurrently searching through
a database. If any one thread return the result, the remaining thread might be cancelled.
3. Thread cancellation is of two types:
(a) Asynchronous cancellation: One thread immediately terminates the target thread.
(b) Deferred cancellation: The target thread periodically checks whether it should
terminate, allowing it an opportunity to terminate itself in an orderly fashion.
With deferred cancellation, one thread indicates that a target thread is to be cancelled, but
cancellation occurs only after the target thread has checked a flag to determine if it should be
cancelled or not.
4.12 Processes vs. Threads
As we mentioned earlier that in many respects threads operate in the same way as that of
processes. Let us point out some of the similarities and differences.
Similarities
1. Like processes threads share CPU and only one thread active (running) at a time.
2. Like processes, threads within a processes, threads within a processes execute
sequentially.
3. Like processes, thread can create children.
4. And like process, if one thread is blocked, another thread can run.
Differences
1. Unlike processes, threads are not independent of one another.
2. Unlike processes, all threads can access every address in the task .
3. Processes might or might not assist one another because processes may originate from
different users, but threads are design to assist one other.
LOVELY PROFESSIONAL UNIVERSITY 65