--------------------------- TECHNICAL NOTE 1 (9/22/01) --------------------------- Here is a summary of troublespots for Assignments A2 and A3, which will be returned to you this week. ASSIGMENT A2 (1) Processes and threads are different objects. A process is a virtual machine containing one or more threads, an address space, executable code, parameters, I/O connections, an environment variables. A thread is a sequence of statewords of a CPU. Starting a new process is expensive compared to starting a new thread because the system has to make a copy of all the components of a process's virtual machine. Threads have their own stacks but share the process address space. This facilitates information sharing and complicates protection. NOTE: context-switching does not apply to processes; only to threads. (2) and (3). The important point is that the interrupt handler gets its own frame pushed on the stack of the current thread; when that handler is done, and executes its return instruction, the current thread will continue from the point of interruption, unaffected. A subtle, but important point is that with certain interrupts (notably clock) there is a context switch; when the ready process returns to the front of the RL and is resumed, it returns from the SAME handler invocation that interrupted it before; when that handler returns, the frame is popped off the stack and the process continues as if it had not been interrupted. See the previous technical note about the way interrupts push and pop frames from the stack. (4) and (5). R(SJF) = 22 sec. R(LJF) = 38.5 sec. R(RR) = 34 sec. No schedule can have shorter R than SJF because moving any longer job ahead of a shorter one will increase the waiting times of the displaced jobs and because SJF can be converted to any other schedule by a series of these simple interchanges. No non-preemptive schedule can do worse than LJF for a similar reason. However, a preemptive schedule can do worse: run every job for 1 microsecond less than its execution time, then preempt, then all the jobs complete within a few microseconds of 55 sec, causing R = 55 sec. It is not possible to do better than SJF with preemption because putting any part of a job earlier in the schedule will increase the response times of all the intervening jobs by that amount. RR is a preemptive schedule that is useful when you don't know the job lengths in advance; it prevents a long job from hogging the CPU. The reponse time of RR depends on its quantum. If you made the quantum larger than 10 sec, the system would run an SJF schedule with R=22 sec; and it you made the quantum very small (processor sharing with 0 switching overhead) it would give response time R=38.5 sec, the same as LJF. (Check this for yourself.) ASSIGNMENT A3 (1) Directories are different objects from files. Directories map user-assigned strings to object handles. The objects may be other directories, files, devices, pipes, virtual machines. Because the object handles are not limited to files, the directory manager cannot be part of the file system. While it is true that directories are usually implemented as files, they could also be implemented as tables in RAM. (2) The given command is syntactically valid. It may not be semantically valid (i.e., it may not be meaningful or executable). The initial segment of the command, outfile