Operating System Chapterwise Notes of Galvin:Threads

Pages>> 1 2 3 4 5 6 7 8
Here we are giving chapter wise notes of operating system based on operating system concepts by galvin


q) what is a thread?
a) it is a lightweight process, a basic unit of cpu utilization. it contains a thread id,program counter,register set and
stack.

q) what do a thread share with other threads of same process?
a) code section and data section.

note:- if a process has more than 1 thread it can do more than 1 task at a time.

q) give example of application with multiple threads?
a) web browser:- 1 thread display images ot text while other retrieves data from network.
word processor:- display graphics,read keystrokes and third one perform grammar and spelling check.

q) what are 2 kinds of threads?
a) 1) user threads and 2) kernel threads.

q) how are user thread implemented?
a) thread libraray.library gives support for thread creation, scheduling and management with nO help from kernel.

q) what is many to one model of threads?
a) there are many user-level threads but only 1 kernel thread.eg:- green threads(a thread library) for Solaris2.

q) what is 1-1 model?
a) each user thread is mapped to a kernel thread.here a user thread creation requires a corresponding kernel thread also.
there is a restriction on the number of threads suported by system. windows nt,2000 use this model.

q) what is a many-many model?
a) many user-level threads mapped to smaller or equal number of kernel threads.

q) how many kernel threads we can have in many-many model?
a) depends either on the particular application or a particular machine.

q) in case of multithreaded program, how can a fork behave?
a) 1) IT DUPLICATES all threads of its parent.
2) it is single threaded.

q) what is thread cancellation?
a) it is the task of terminating a thread before its completion.

q) any example of thread cancellation?
a) 1) if multiple threads are searching through database and 1 returns the result,remaining are cancelled.
2) if u click stop button in web browser,it stops web page from loading any further.
the thread that is to be cancelled is called the target thread.

q) what are 2 different kinds of thread cancellation?
a) 1) asynchronuos:- one thread immidiately terminates the target thread.
2) deffered:- target thread checks itself periodically to check if it should terminate.

q) what is difficulty in cancellation?
a) in situations where resources have been allocated to the cancelled thread, or if thread is cancelled in middle of
updating data it is sharing with other threads. in case of asynchronous cancellation it may occur that o.s is not able to
reclaim all resources from the thread.

q) what is signal used for ?
a) used in unix systems to notify a process that a particular event has occured. it may be recieved synchronously or
asynchronously depending on source and reason for event being signalled.

q) tell about synchronous signal?
a) it occurs when illegal memory access is there or division by 0 takes place.synchronous are delived to same process that
performed the operation causing signal.

note:- asynchronous signal is sent to other process.

q) what are various signal handlers?
a) 1) default signal handler.
2) user-defined -do-.

note:- take example of web server. it creates a new thread when a new request comes to it.if more requests are there, then
more threads may exhaust the system resources.to solve this we have thread pool.

q) what is concept of thread pool?
a) at time of process startup, create a number of threads and place them in pool to wait for work.they finish work and then
come back to pool. if request come and no thread is available, then request has to wait.

q) what is thread specific data?
a) each thread share data of process, but sometimes it may need its own copy of data. such data is called thread specific
data.

q) what are Pthreads?
a) it refers to a POSIX standard defining an API for thread creation and synchonization. it is specification for thread
behaviour not its implementation. o.s developer can use these specifications in any way he likes.generally libraries
implementing Pthreads are confined to the unix-based system like Solaris2.

Pages>> 1 2 3 4 5 6 7 8





Reblog this post [with Zemanta]

0 comments:

Post a Comment