Thread is a sub part of a process . Multiple Thread Model involve the existence of multiple threads. Three are main problem in multiple thread model.
- Deadlock :- Suppose there are two thread T1 & T2 of a process P and R1 & R2 are two resouces . T1 has R1 and T2 has R2 at intance of time . suppose T1 need a resource R2 that are acquired by the T2 and T2 need a resource R1 that are acquired by the T1 then these type of situation goes in unlimited waiting i.e. these situation called Deadlock Problem.
- Stravation :- Suppose thread are processed on the base of Priority (More Priority Processed First),T1 & T2 are two thread .T1 has more priority than T2 than T1 first processed and suppose in mean time another thread T3 come with high priority than T2 , T3 processed before than T2. and so on then t2 has wait for limited of a time while thread has a capability to perform work.This type of situation is called stravation.
- Synchronization :-The biggest problem of allowing multiple threads sharing the same data set is that one operation in one thread could collide with another operation in another threads on the same data. When this happens, the result is un-desirable.
If the threads are running independently, the following could happen:
Time 01:01 02:01 03:01 04:01 +----------+---------+---------+------- Thread 1 Get Set Action You Account Account You Withdraw Balance Balance Receive $50.00 $100.00 $50.00 $50.00
Time 01:02 02:02 03:02 04:02 -+----------+---------+---------+------ Thread 2 Get Set Action Friend Account Account Friend Withdraw Balance Balance Receive $50.00 $100.00 $50.00 $50.00
Time 01:01 02:01 03:01 04:01 -----------++--------++--------++------ Account $100.00 $100.00 $50.00 $50.00Both you and your friend will receive $50.00 each, and your account will still have $50.00. The bank could lose $50.00. The solution to this problem is synchronization.
Note:-Please comment and reply me.
0 comments:
Post a Comment