









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










Please answer concisely. If you find yourself writing more than a few sentences, your answer is probably wrong.
page size to support paging.
12-bit top level field, an 8-bit second level page table field, and an offset. How large are the pages, and how many are there in this address space?
Inodes in the new ext14 file system have an iblock with ten 32-bit pointers. The first 8 pointers are direct point- ers to blocks, the ninth pointer is a single indirect pointer, the tenth pointer is double indirect. Assuming 2048 byte blocks, what is the largest file size supported by the ext14 file system? Also, what is the largest supported disk size?
Name: 5
You are developing a driver for a sound card. The device has a set of memory-mapped control registers and a single audio channel for playback. When playing audio, the device asserts its interrupt line when its internal hardware playback buffer is more than half empty. The card supports multiple audio input formats in hardware, such as 8-bit and 16-bit sound samples, various audio encodings and sample rates. The driver buffers audio data in the kernel in non-swappable memory, then transfers it to the device.
mmap, open, flush, release, fsync, lock, check flags...) should be used for each of the following operations? Briefly explain your choices.
instead of using the unified (open, lock, flush) file operations. Give one advantage and on disadvantage to this approach.
Name: 7
This question will demonstrate your understanding of disk access policy on system performance. Supoose that a disk rotates at 6,000 RPM, so that it completes one rotation every 10 milliseconds. There are 1,000 sectors per track. Suppose that there are two files, A and B, each three disk-sectors long, laid out on a single track in the six contiguous sectors (178-183) as shown in the figure.
10 ms
178
183
179 180 181 182
B A B A B A
For simplicity, assume that a disk sector can be read instantaneously once the disk read-head is positioned correctly, and that operating system functions also execute instantaneously. There are two processes running concurrently, pro- cess 1 and process 2. The scheduler starts process 1 first.
void process_1(void) { int i;
for (i=0; i<3; i++) { read(fileA, sizeof(sector)) ... processing... ... } }
void process_2(void) { int i;
for (i=0; i<3; i++) { read(fileB, sizeof(sector)) ... processing... ... } }
Each process will read one sector of data from its file, process the data for 3 milliseconds, and repeat for each block of the file. The scheduler will optimize disk access so as to minimize the CPU’s idle state. In any calculations you do, round to the nearest millisecond - in particular, only count disk-rotation times and process execution times. For parts A-C mark an arrow with the sector number when the harddrive retrieves a sector, and mark an arrow with the sector number when the CPU finishes processing a sector.
system performs disk accesses in the order they are requested (FIFO) and the disk returns the data as soon as the read-head reaches the correct sector? Complete the graph below. The first CPU and harddrive operations have been done for you. (Assume that at time 0, the read-head is on the correct track at sector 180, grep is executing on the CPU, and processes only sleep when they attempt to access a disk block not already in memory).
Disk: (^6) A 0
sorts IO accesses by sector, making disk requests in order of increasing sector number?
Disk:
In this problem you will demonstrate your mastery of Page Table manipulation. We have attached to this exam two pages from the AMD-64 System Programming guide containing a diagram of virtual-to-physical address translation on a 64-bit processor with 2-Megabyte page frames and a 3-level page table system. The terminology used is slightly different from what you have seen in class, but the diagrams should be clear.
Notice that virtual addresses are 48-bits long, and that tables in the Page Table hierarchy contain 512 64-bit entries; the tables are still 4 kilobytes, but you index into them with 9 bits of the virtual address. As indicated in the diagrams, only the low 52 bits of the 64-bit page table entries are meaningful (ignore the NX bit).
Below, write the C function find pte. find pte takes two arguments: a copy of the 64-bit CR3 register, which points to the root of the Page Table Hierarchy; and a virtual address. find pte should return a pointer to the page table entry corresponding to that virtual address’s page (a pointer to a PDE, in the terminology of the provided documentation). If the corresponding Page-Directory-Pointer-Table or Page-Directory-Table do not exist, your find pte should invoke the get page function to allocate it. ( Hint: You may want to save time by making a helper function to retrieve the approprate bits from an integer.)
/* allocates and returns a page (4 Kilobytes) of memory. Never fails. (^) */ extern void (^) * get page();
/* turn a pointer to a page-directory-pointer-table
** into^ a page-map-level-4 entry */ extern uint64 t make pml4e( void (^) *);
/* turn a pointer to a page-directory--table
** into^ a page-directory-pointer-table entry */ extern uint64 t make pdpe( void (^) *);
Name: 11
uint64 t (^) *find pte( uint64 t (^) *pdbr, uint64 t vaddr){
Name: 13
Virtual Address
Sign Extend^ Page Offset
Page-Map Level-4 Table Offset (PML4)
Page-Directory- Pointer Offset
Page-Directory Offset
63 48 47 3938 3029 2120 0
Physical Address PDE
PDPE PML4E
9 9 9
52*
52*
52*
Page-Map Level- Table
Page- Directory- Pointer Table
Page- Directory Table
2 Mbyte Physical Page
Page-Map Level-
51 12
*This is an architectural limit. A given processor implementation may support fewer bits.
21
Base Address