Docsity

Operating System - Implementation of Process MINIX 3 - Notes, Study notes of Operating Systems

Partial preview of the text

Download Operating System - Implementation of Process MINIX 3 - Notes and more Study notes Operating Systems in PDF only on Docsity!

Implementation of Processes in

MINIX 3

Layers of Minix in Source Code

Location Layers src/kernel/ layer 1 (scheduling, messages, clock and system tasks). src/drivers/ layer 2 (device drivers for disk, console, printer, etc.). src/servers/ layer 3 (process manager, file system, other servers).

MINIX Memory (2)

Clocks

  • (^) A computer has a timer, not a clock.
  • (^) A timer is a precisely machined quartz crystal oscillating at a frequency that depends on how the crystal was cut and the amount of tension.

Clocks

  • (^) Two registers are associated with the crystal: a counter and a holding register. - (^) Each oscillation of the crystal decrements the counter by one. When counter is 0, an interrupt is generated. - (^) Each interrupt is called a clock tick. - (^) At each clock tick, the interrupt procedure adds one to the time stored in memory. The counter is reinitialized by the value in the holding register. - (^) A timer can be programmed to generate an interrupt n times per second.

Clock Software

  • (^) Let’s start with line 10468 which is the start of the clock_task() function - (^) Expects only type of message: Interrupt - (^) Gets this message when a quantum expires - (^) Results in a call to do_clocktick()
  • (^) The function clock_handler() function executes for each tick

Clock Software

  1. Maintaining the time of day.
  2. Preventing processes from running longer than they are allowed to.
  3. Accounting for CPU usage.
  4. Handling the alarm system call made by user processes.
  5. Doing profiling, monitoring, and statistics gathering.

Minix Source code files

include/ansi.h

  • (^) It shows the type of C Complier and its compatibility with Minix C code.

include/limits.h

include/errno.h

  • (^) The <errno.h> header defines the numbers of the various errors that can occur during program execution.
  • (^) They are visible to user programs and should be small positive integers.
  • (^) However, they are also used within MINIX, where they must be negative.

include/errno.h

include/unistd.h

  • (^) The <unistd.h> header contains a few miscellaneous manifest constants.