In-class notes for 09/25/2019
CS 273 (OS), Fall 2019
HW5 assignment, first stages of developing shell project
Note: Lab 2 is the first step, so you can submit something on time.
The other steps are much shorter than Lab 2!
CI feedback on commits
Merge commit...
Readings - see Syllabus
Please do readings on time (though we got behind in class recently)
Bring questions to class, or ask RAB by email so they can be answered in class
Threads and race conditions
Threads - multiple execution paths within a single process.
Differences between a process and a thread
Examples of code with threads
Will introduce programming with pthreads next time
Race conditions - correct behavior of the computation depends on timing
Demonstration - OpenMP program
trap_omp.c.The program correctly computes the area under one loop of the
sin(x)curve (mathematical answer 2) for one thread in the command~rab/os/egs/trap_omp 1
What happens when there are more than one thread?
~rab/os/egs/trap_omp 2 ~rab/os/egs/trap_omp 4
Explanation...
-
In-class acted algorithms (3)
sleep()andwakeup()functions?sleep()blocks the calling thread/processwakeup()unblocks another thread/process
Locating race conditions in code
< >