Beginnings of Operating Systems
history of operating systems
- Goal: To look at the history of operating systems and see why they
developed as they did; to se the basic functions and designs of
operating systems
- First Generation (vacuum tubes)
- hardware only, open shop
- Second Generation (transistors)
- separation of programmers and operators
- batching, satellite systems, buffering
- device independence, resident loaders, first operating system, JCL
- Atlas system: extracodes, interrupts, virtual memory
- Third Generation (integrated circuits)
- spooling, job scheduling, multiprogramming
- protection, traps, fence registers, privileges, system calls, time sharing
- virtual machines: levels of abstraction, THE system
- customer service, compatibility
- Fourth Generation (VLSI)
- minicomputers: rise of the UNIX operating system
- microcomputers: workstations, personal computers, open operating systems
- Networks and Distributed Systems
- networked vs. distributed operating systems
Operating Systems Functions
- Goal: To look at common operating system functions, see what a good
operating system needs to do, desireable features.
- I/O Functions
- polling, interrupt-driven
- DMA, I/O controller
- Process Functions
- creation
- deletion
- scheduling
- synchronization, communication
- Memory Functions
- allocation
- deallocation
- management
- Secondary Storage Functions
- bringing data in and out
- address translation
- User Interface Functions
- command interpreter
- job control language
- Desireable Features
- efficiency
- reliability
- maintainability
- smallness
Organization of operating systems
- monolithic: processes are subroutines
- kernel: operating system calls are subroutines
- process hierarchy: virtualize lower level resources
- object oriented: view system as collection of objects
(processes, procedures, pages, devices, messages, etc.)
and capabilities (pointers to objects, also containing rights).
- client-server model: kernel just passes messages
User Interface
- controls how the user interacts with the system
- types of software
- kernel
- essential utilities
- optional utilities
- Command Interpreter
- batch job control language
- interactive job control language
- Invoking programs
- search path
- global and local environments
- user principle
- little languages
The kernel
- Question: how do processes interact with the hardware of the computer?
What does the program that mediates this interaction (kernel) look like?
- The system kernel
- interface between machine hardware and the operating system
- first-level interrupt handler, dispatcher,
interprocess communication primitives
- Processes in the kernel
- process control blocks
- ready queue, device queues, other queues
- CPU/IO Burst Cycle
- Dispatcher
MINIX Context Switch Routine
Introduction
This is the MINIX context switch routine; it is lines 6319-6345 of the
MINIX operating system (see the text, p. 596). My comments follow the
program.
The basic idea is to execute any pending interrupts. If there are any,
the process receiving the interrupt becomes the current task;
otherwise, the current task is the one already chosen. Load the segment
descriptors for the task to be run, reset the interrupt vector so the
next interrupt will cause the process state for the task to be saved
properly, reset the registers, and return to the next task.
Program
06319 |*===========================================================================*
06320 |* restart *
06321 |*===========================================================================*
06322 _restart:
06323
06324 ! Flush any held-up interrupts.
06325 ! This reenables interrupts, so the current interrupt handler may reenter.
06326 ! This does not matter, because the current handler is about to exit and no
06327 ! other handlers can reenter since flushing is done only when k_reenter == 0.
06328
06329 cmp (_held_head),0 ! do fast test to usually avoid function call
06330 jz over_call_unhold
06331 call _unhold ! this is rare so overhead acceptable
06332 over_call_unhold:
06333 mov esp,(_proc_ptr) ! will assume P_STACKBASE == 0
06334 lldt P_LDT_SEL(esp) ! enable segment descriptors for task
06335 lea eax,P_STACKTOP(esp) ! arrange for next interrupt
06336 mov (_tss+TSS3_S_SPO),eax ! to save state in process table
06337 restart1:
06338 decb (_k_reenter)
06339 o16 pop gs
06340 o16 pop fs
06341 o16 pop es
06342 o16 pop ds
06343 popad
06344 add esp, 4 ! skip return adr
06345 iretd ! continue process
Comments
- 06331
- If MINIX takes this call, it enters a routine that pulls the
first process off the interrupt queue and puts it into the ready
position (see the routines over_call_unhold at 07397-07419
and interrupt at 06935-07003).
- 06332-06345
- If the restoration of registers is interrupted, then the system
will have to know which ones were changed and which ones were not.
This is not possible, so interrupts are ignored.
- 06333-06337
- These lines prepare interrupt addresses and task segments for the
next task to run.
- 06338
- The control is about to leave the kernel. _k_reenter
is the number of times the kernel has re-entered (invoked itself). If
this variable is 1, the next task is not a kernel task. Otherwise, it
is. While within the kernel, user-level interrupts are disabled.
- 06339-06343
- These restore all the registers of the process to be run except the
return address, which must be handled specially.
- 06344
- Here the stack pointer is reset.
- 06345
- This returns control to the next task. It takes the return address
from the stack (which is what the previous instruction sets up) and
puts it in the program counter.
Send email to
cs150@csif.cs.ucdavis.edu.
Department of Computer Science
University of California at Davis
Davis, CA 95616-8562
Page last modified on 1/7/00