进程同步有关术语解释

进程同步相关术语解释Race Condition: A situation where1. serveral processes access and manipulate th

进程同步相关术语解释
Race Condition: A situation where
    1. serveral processes access and manipulate the same data concurrently
    2.the outcome of the execution depends on the particular order in which the access takes place


Critical Section: a segment of code
    If process p1 is executing in its critical section, then no other processes can be executing in their critical sections
   
    
Semaphore: a syncrhonization tool
    A semaphore contains an integer variable is accessed only through two standard operations: acquire() and release()
   

            Semaphore sem = new Semaphore(1);        sem.acquire();            //critical section        sem.release();            //remainder section    
   
   
Spinlock (自旋锁): 是一种Semaphore,它能造成一种情形:
    一个进程由于等待锁而不停地空转。这个空转的感觉就像在"spin"(自旋)
    由于自旋时进程仍处于运行态,所以很浪费CPU.
   
   
Deadlock: a situation where
    two or more processes are waiting indefinitel for an event that can be caused by one of the waiting processes.
   
   
Starvation, or Infinite Blocking:
    1. 一种状况:进程永远获取不到锁
    2. 如果锁的等待队列采取LIFO模式,就会靠成这种状况