Memory Allocation:
MINIX directory:
usr
/ \
/ \
include src
/ | \ |
minix kernel
| |
type.h proc.h
(p.558) (p.581)
(message definition)
Page 558: type.h (handle message passing)
| struct foo
{ double a; int b; char c; }; struct foo bar; |
union foo2
{ double a; int b; char c; }; union foo2 bar2; |
struct: The addresses of a, b, and c are sequential located.
They have different offsets.
union: a, b, and c are stored only one at a time.
They have same offsets. This example the size of bar2 is same as
the size of double.
In MINIX, we actually have process table divided into 3 parts.
These three tables are parallelly operated.
i.e. The positions n of the arrays of the kernel, mm, file process
tables refer to the same process.
kernel mm FS
|
|
||
| (n) | (n) | (n) |
|
|
All elements of index n describe the same process.
Identify process:
Page 591 MINIX (assembly
part)
Once the bootstrap process has loaded the O.S. into memory, control
is transferred to the lable MINIX.
Page 601 main
Initialize t as-NR_TASKS
(task's number). We want the tasks have negative label and
normal process has positive label.
In C, a[i] is just another
way of writing *(a+i).
wants gets
User Precesses
Servers
0 -1 -2 -3
Tasks
-NR_TASKS 0
Page 602, lines 06785 to 06790: (Set Registers)
rp->p_map[T].mem_len = text_clicks;Page 596 Restart
rp->p_map[D].mem_phys = text_base + text_clicks;
rp->p_map[D].mem_len = data_clicks;
rp->p_map[S].mem_phys = text_base + text_clicks + data_clicks;
rp->p_map[S].mem_vir = data_clicks; /* empty - stack is in data */
Stack (grow downward)
Data (grow upward)
Text (Codes)
(Two processes may read the same program)
Store registers.Page 595 SAVE
Entry for hardware interrupt. Get control from process.Page 595 -s-call
Entry for software interrupt.Page 605 sys-call
Check deadlock.Page 607 mini-rec