PKUOS - Pintos
Pintos source browser for PKU Operating System course
Data Fields
lock_and_sema Struct Reference

Low priority thread L acquires a lock, then blocks downing a semaphore. More...

Collaboration diagram for lock_and_sema:
Collaboration graph
[legend]

Data Fields

struct lock lock
 
struct semaphore sema
 

Detailed Description

Low priority thread L acquires a lock, then blocks downing a semaphore.

Medium priority thread M then blocks waiting on the same semaphore. Next, high priority thread H attempts to acquire the lock, donating its priority to L.

Next, the main thread ups the semaphore, waking up L. L releases the lock, which wakes up H. H "up"s the semaphore, waking up M. H terminates, then M, then L, and finally the main thread.

Written by Godmar Back gback.nosp@m.@cs..nosp@m.vt.ed.nosp@m.u.

Definition at line 19 of file priority-donate-sema.c.

Field Documentation

◆ lock

struct lock lock_and_sema::lock

Definition at line 21 of file priority-donate-sema.c.

Referenced by h_thread_func(), and l_thread_func().

◆ sema

struct semaphore lock_and_sema::sema

Definition at line 22 of file priority-donate-sema.c.

Referenced by h_thread_func(), l_thread_func(), and m_thread_func().


The documentation for this struct was generated from the following file: