








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.
the TLB to enhance performance. Ben suggests that each TLB entry should also contain a task identifier to reduce context switching overhead. Is this a good or bad idea? Why?
page size to support paging.
Name: 5
are direct pointers 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?
onds. Suppose that there is one file, A, three disk-sectors long, laid out on a single track in the three contiguous sectors (178-180).
At the command line, a user executes the following command:
$ grep foo A
This causes the grep program to read from file A. grep will read one sector of data from its file, process the data for 2 milliseconds, and repeat for each block of the file. In any calculations you do, round to the nearest millisecond - in particular, only count disk-rotation times and process execution times.
How long does this command take to complete on a uniprocessor machine if the disk returns the data as soon as the read-head reaches the correct sector? (Assume that at time 0, the read-head is on the correct track at sector 180, and grep is executing on the CPU).
Name: 7
You have decided to implement a new system call put list() in order to make copying data between user and kernel code easier. This system call copies a linked list from user space to kernel space, thus enabling you to do most of your list logic in user space and then send it to the kernel.
Each part of this problem is one step in the system call process. You must implement each of the following functions. Note that there are enough helper functions provided that you should be able to implement all of these functions completely in C. You are not required to use the exact same registers that linux uses.
/* the put list system call number */ #define LISTNUM 37
/* register structure
** this^ type exists in^ both kernel and^ user mode */ typedef struct { int eax; int ebx; int ecx; int edx; int edi; int ebp; int esp; int esi; } reg t;
/* list structure
** this^ type exists in^ both kernel and^ user mode */ struct list { struct list next; int size; / The number of bytes in the data field / void data; };
/* this function allows you to perform the x86 INT instructions in C
** exists in^ user mode */ void interrupt( char vector number);
/* Data Marshaling / / function that takes a reg t struct and puts the members into the appropriate registers
** exists in^ both kernel and^ user mode */ void put in regs( reg t (^) *registers);
/* function that puts the current value of the registers into the structure passed to it
** exists in^ both kernel and^ user mode */ void get out regs( reg t (^) *registers);
/* executes the x86 iret instruction */ void iret()
/* returns: whatever the call it calls returns
** this^ function exists in kernel space ** Unmarshals data and^ invokes appropriate system call by switching on^ system call #/ int system call() { / Unmarshal arguements */
/* switch on system call / switch( ) / Fill this in (^) / { ... / other cases */
case : /* Fill this in (^) */
... /*other cases / } / Cleanup */
Name: 11
/* returns: 0 and kernellist points to new list on success
** -1^ and kernellist points to null on^ failure ** (ie.^ memory copy incomplete due to^ bad pointers) ** ** this^ function exists in kernel space ** Allocates a new list^ in kernel space, returns pointer in^ kernellist argument */ int sys put list( struct list (^) *userlist, struct list (^) *kernellist) {
Name: 13
- Bits 63–48 are a sign extension of bit 47 as required for canonical address forms. - Bits 47–39 index into the 512-entry page-map level-4 table. - Bits 38–30 index into the 512-entry page-directory-pointer table. - Bits 29–21 index into the 512-entry page-directory table. - Bits 20–0 provide the byte offset into the physical page.
- Figure 5-23 on page 137 shows the PML4E (page-map level-4 entry) format. - Figure 5-24 on page 137 shows the PDPE (page-directory-pointer entry) format. - Figure 5-25 on page 137 shows the PDE (page-directory entry) format.
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
5.4 Page-Translation-Table Entry Fields
63 62 52 51 32 N X
Available (^) (This is an architectural limit. A given implementation may support fewer bits.)Page-Directory-Pointer Base Address
31 12 11 9 8 7 6 5 4 3 2 1 0
Page-Directory-Pointer Base Address AVL MBZ
I G N
A
P C D
P W T
U / S
R / W
P
63 62 52 51 32 N X
Available Page-Directory Base Address (This is an architectural limit. A given implementation may support fewer bits.) 31 12 11 9 8 7 6 5 4 3 2 1 0
Page-Directory Base Address AVL MBZ
I G N
A
P C D
P W T
U / S
R / W
P
63 52 51 32 N X Available Physical Page Base Address (This is an architectural limit. A given implementation may support fewer bits.) 31 21 20 13 12 11 9 8 7 6 5 4 3 2 1 0
Physical Page Base Address Reserved, MBZ
P A T
AVL G 1 D A
P C D
P W T
U / S
R / W
P