# Rick van der Zwet # 0433373 # OS Assigment 4 # Licence: BSD # $Id: README.txt 540 2008-04-01 20:51:39Z rick $ = Intro = File compiled on mac os x, gcc 4.0.1, and linux gcc 4.1.2. = Files = Makefile = Makefile to generate executables of C code assignment4a.c = Source code part A assignment4b.c = Source code part B assignment4c.c = Source code part C README.txt = Currently reading = Part A = It measurement times varies between 1 clocktick and 20000. It kind of depends on the OS when it swiches to a different thread and at which point. = Part B = No need for mutexes as processes will only write one variables and read the other ones. No variable is needed to be written by 2 threads. So simple checking when something is changed is suffient = Part C = Peterson's algoritm is very well documented at http://en.wikipedia.org/wiki/Peterson's_algorithm which include a rather advanced example of locking and editing. In our consumer/producer world are things way more easy. So locking/unlocking is relatively simple done, due the fact we are context switching between one consumer and one producer. There are no multiples. = Part D = Think of specilized threads inside a program waiting to do a difficult computation. The UI detects difficult program, passes the formula into 'worker' thread and get the result when done.