Fri Sep 9 11:27:56 2005 Tanenbaum reading: pp 34-35 pp 48-50 pp 71-80 Mentioned pre-multi-tasking Mac OS, which had 32k "desk accessories" that could be opened while an app was still open. showed Andy Hertzfeld "NerdTV 001" excerpt, where he talked about developing the "Switcher" for Mac OS. This allowed a single-process OS (e.g., the original Mac OS) to background processes (in the first version, they were idle in the background). Get the file using http://www.cs.uml.edu/~fredm/courses/91.308-fall05/files/ntv001.mp4.torrent A hack to MS-DOS included the "TSR" (terminate-and-stay-resident) concept which let little programs be backgrounded while a main app was running; these could then be called up with a keystroke. To set your perms right to turn in assignment: 1. make sure other-execute bit is set on your home dir: cd ~ chmod go+x . This lets others get at files in your home dir, if they already know their name. 2. make sure other-execute bit is set in your homework dir, e.g.: cd ~ mkdir 308 chmod go+x 308 This lets others get at files in the homework dir ("308"). 3. make sure your turn-in files have the other-read bit turned on: cd ~/308 cat > Assign1.c (create a file named Assign1.c) (type Ctrl-D to exit the 'cat') chmod go+r Assign1.c 4. give a friend the path to your file, have them log in, and make sure they can view the file. e.g., for the example above, your friend would try: more ~/308/Assign1.c Went over Process state table (pp. 80 of Tanenbaum) Demo'ed code that grabs the PID, and saw that child after a fork() has an incremented PID. Extended code to capture fork's return value, and run diff code in parent and child based on that return value. Fork returns 0 in the parent, and the new proc PID number in the child (i.e., the child's own PID). ---------------------------------------------------------------------- #include #include #include #include #include #include int main(void) { pid_t oldpid, newpid; int i; oldpid = getpid(); printf ("hello this is fred's program, before fork\n"); printf("my pid is %d\n", oldpid); i= fork(); if (i == 0) { // parent printf("I am the parent\n"); } else { printf("I am the child and my PID is %d\n", i); } } ----------------------------------------------------------------------