Introduction to Programming

X52_9239_003

Spring 99

 

Homework 3 - Solution

 

 

Problem #13, p. 126:

List five resources coordinated by a multitasking OS:

Memory manager:

Allocates memory.

File manager:

Manages the file allocation table, access and storage of files.

Scheduler:

Manages process entries in process table.

Dispatcher:

Allocates time slices to processes currently in the process table.

Device drivers:

Handle operations on peripherals.

Problem #15, p. 126:

Greater throughput achieved if one process is I/O bound and the other is compute-bound. In this case, time slices can be allocated and shared between the two processes. If both processes were I/O bound, the first process would have to terminate before the second one could be executed.

Problem #18, p. 126:

  1. Process begins its time slice allocated by the dispatcher.
  2. When the time slice expires, an interrupt is generated.
  3. The CPU receives the interrupt and completes the fetch-decode-execute cycle.
  4. The CPU saves the current process state.
  5. The CPU executes processes the interrupt and passes control to the dispatcher.
  6. The dispatcher allows the scheduler to update the process table and update the priorities of the various processes in that table.
  7. The dispatcher picks the process with highest priority, allocates a time slice and launches the selected process.

Problem #23, p. 126:

4,294,967,296 (232)

Problem #27, p. 126:

http://frogs.animals.com/animals/moviestars/kermit.html

http

Hypertext transfer protocol used to access document on the web.

frogs

Host name.

animals.com

Domain name (animals is the company name).

com

Identifies a commercial institution.

animals/moviestars

Access path of document in the host's file system.

kermit.html

Document name

Problem #38, p. 128:

After a task completes its time slice, the scheduler updates the priorities of the various tasks in the process table. In particular, the priority of the task, which just completed its time slice, is lowered so another task can take its place. If all tasks had same priority, the scheduler would not update the process table, and all tasks but the one initially started would starve.