Loose Ends; Midterm Review
Tom Kelliher, CS 318
Mar. 30, 1998
Announcements:
From last time:
-
Outline:
-
Assignment:
Definitions:
- Layered System --- A system in which pieces are built on top of other
pieces, with hardware as a foundation. A layer make calls
exclusively to the layer beneath it.
Advantages:
- Well defined structure.
- Modular.
- Information Hiding.
Disadvantages:
- Poor performance on ``deep'' calls --- latency.
- Difficulty in creating a ``good'' layered design.
- Micro Kernel --- A small executive that provides only necessary
functionality to support threads/processes:
- CPU scheduling.
- Process primitives: create, destroy, suspend, activate, change
priority, etc.
- IPC.
- Virtual Memory.
- Interrupt handlers.
- Device driver interface.
Runs in kernel (supervisor) mode. Everything else runs in user mode.
Advantages:
- Only a small amount of code runs in kernel mode.
- Easily extended.
- System routines work with an abstract machine model --- portability.
Disadvantages:
- System calls require a context switch (slow).
- Not easily extended (traditional kernel).
Weak layering:
Traditional kernel:
Micro kernel:
A strictly layered system:
Lowest software level (between kernel and hardware) provides a virtual
machine interface to multiple, independent kernels. IBM VM. Java
VM.
- Support for OS development alongside a production system.
- Virtual user/monitor mode, real user/monitor mode.
- How is a disk operation carried out?
- Virtual Machine is a simulation:
- Simulate one architecture with another.
- Efficiency?
- How are physical devices (a disk) ``virtualized?''
- Java portability: ``Write once run anywhere.''
- Java security: the ``sandbox.'' Access to local resources. Security
or impediment to application development?
- Java consistency: same look, feel between platforms?
Resources owned by kernel, allocated to processes.
Messages kept in a queue.
Assume:
- Only allocating process may execute receive.
- Any process (including ``owner'') may send.
- Variable-sized messages.
- Infinite capacity.
Primitives:
- int AllocateMB(void)
- int Send(int mb, char* message)
- int Receive(int mb, char* message)
- int FreeMB(int mb)
Consider:
Process1()
{
...
S1;
...
}
Process2()
{
...
S2;
...
}
How can we guarantee that S1 executes before S2?
The situation:
Tape allocator process:
initialize();
while (1)
{
Receive(Tamb, message);
if (message is a request)
if (there are enough tape drives)
for each tape drive being allocated
{
fork a handler daemon;
send daemon mb # in message to requesting process;
update lists;
}
else
send a rejection message;
else if (message is a return)
{
update lists;
send an ack message;
}
else
ignore illegal messages;
}
Summary of user process actions:
- Send request to tape allocator.
- Receive message back giving mailbox(es) to use in communicating with
tape drive(s).
- Start sending/receiving with tape drive daemon(s).
- Close tape drives.
- Send message to tape allocator returning tape drive(s).
Thomas P. Kelliher
Thu Mar 26 13:30:29 EST 1998
Tom Kelliher