16.05.2015 Views

Working with the Unix OS

Working with the Unix OS

Working with the Unix OS

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Processes I<br />

The u area contains<br />

- pointer to process table identifiers<br />

- real and effective user ids<br />

- timer fields<br />

- how to react to signals<br />

- control terminal "login terminal"<br />

- error field<br />

- return value<br />

- amount of data to transfer<br />

- user buffer address<br />

- file offset<br />

- current directory<br />

- user file descriptors<br />

- limits to restrict size of process<br />

- permission modes mask<br />

Layout of System Memory<br />

A process has three logical sections:<br />

- text<br />

- data<br />

- stack<br />

The compiler generates addresses for a virtual address space and machine’s memory management translates this to<br />

physical memory.<br />

Regions<br />

A Region is a contiguous area of virtual<br />

address space of a process that can be<br />

treated as a distinct object.<br />

Several processes can share a region. e.g.<br />

processes can execute <strong>the</strong> same program,<br />

share one copy of text region; processes<br />

can share a common shared memory area.<br />

Each process contains a private per<br />

process region table called a pregion.<br />

Figure 7. Processes and Regions<br />

Pages and Page Tables<br />

In a memory management architecture based on pages, <strong>the</strong> hardware divides physical memory into a set of<br />

equalized blocks called pages.<br />

If a machines has 2^32 bytes of physical memory and a page size of 1k, it has 2^22 pages of physical memory,<br />

every 32-bit address can be treated as a pair consisting of a 22-bit page number and a 10-bit offset into <strong>the</strong> page.<br />

Logical Page Number | Physical Page Number<br />

0 177<br />

1 54<br />

2 209<br />

3 17<br />

Assuming a page is lK bytes, want to access virtual memory address 68, 432. Therefore it is in <strong>the</strong> stack region,<br />

byte offset 2986 in <strong>the</strong> region, counting from 0, <strong>with</strong> byte offset 848 of page 2, physical address 986k.<br />

Memory management register triples<br />

- address of <strong>the</strong> page table in phys<br />

- first virtual address mapped<br />

- number of pages in <strong>the</strong> page table<br />

100

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!