CSE 30 -- Lecture 20 -- Dec 4


Last lecture.

Topics covered (briefly): mentioned test-and-set atomic instruction, where a processor gains exclusive use of the memory for the entire duration of the instruction; multiprocessors and cache coherency; snoopy caches.

Making a machine a multiprocessor slows down the hardware. The software incurs the mutual exclusion mechanism overhead as well as extra context switch overhead when the number of threads exceed the number of real processors. Furthermore, some problems inherently do not have much parallelism. So whether multithreading actually will increase performance depends on many factors (especially whether the program actually runs on a multiprocessor).

DeMorgan's Thm. Example of converting C code

	if ((a && b) || c) {
		... body ...
	}
	... rest ...
to assembly by repeated application of DeMorgan's Thm. The main point is that the ``natural'' logical operation in a sequence of if ... goto (beq, blt, etc) instructions is OR. Through a series of transformations, the above turns into:
	if !a goto L2
	if b goto L0
L2:	if !c goto L1
L0:	... body ...
L1:	... rest ...
In addition to DeMorgan's Thm, we also made the following transformation, where
	if x then L0
	j L1
L0:	... stuff ...
L1:	... rest ...
is optimized into
	if !x then L1
	... stuff ...
L1:	... rest ...

The final is open notes, open book.


[ CSE 80 | ACS home | CSE home | CSE calendar | bsy's home page ]
picture of bsy

bsy@cse.ucsd.edu, last updated Wed Dec 4 21:41:15 PST 1996.

email bsy