From 01a6c054d548d9fff8bbdfac4d3f3de4ae8677a1 Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Wed, 7 Sep 2011 11:49:14 -0400 Subject: Remove web directory; all cruft or moved to 6.828 repo --- web/xv6-sched.html | 96 ------------------------------------------------------ 1 file changed, 96 deletions(-) delete mode 100644 web/xv6-sched.html (limited to 'web/xv6-sched.html') diff --git a/web/xv6-sched.html b/web/xv6-sched.html deleted file mode 100644 index f8b8b31..0000000 --- a/web/xv6-sched.html +++ /dev/null @@ -1,96 +0,0 @@ -Homework: Threads and Context Switching - - - - - -

Homework: Threads and Context Switching

- -

-Read: swtch.S and proc.c (focus on the code that switches -between processes, specifically scheduler and sched). - -

-Hand-In Procedure -

-You are to turn in this homework during lecture. Please -write up your answers to the exercises below and hand them in to a -6.828 staff member at the beginning of lecture. -

-Introduction - -

-In this homework you will investigate how the kernel switches between -two processes. - -

-Assignment: -

- -Suppose a process that is running in the kernel -calls sched(), which ends up jumping -into scheduler(). - -

-Turn in: -Where is the stack that sched() executes on? - -

-Turn in: -Where is the stack that scheduler() executes on? - -

-Turn in: -When sched() calls swtch(), -does that call to swtch() ever return? If so, when? - -

-Turn in: -Why does swtch() copy %eip from the stack into the -context structure, only to copy it from the context -structure to the same place on the stack -when the process is re-activated? -What would go wrong if swtch() just left the -%eip on the stack and didn't store it in the context structure? - -

-Surround the call to swtch() in schedule() with calls -to cons_putc() like this: -

-      cons_putc('a');
-      swtch(&cpus[cpu()].context, &p->context);
-      cons_putc('b');
-
-

-Similarly, -surround the call to swtch() in sched() with calls -to cons_putc() like this: - -

-  cons_putc('c');
-  swtch(&cp->context, &cpus[cpu()].context);
-  cons_putc('d');
-
-

-Rebuild your kernel and boot it on bochs. -With a few exceptions -you should see a regular four-character pattern repeated over and over. -

-Turn in: What is the four-character pattern? -

-Turn in: The very first characters are ac. Why does -this happen? -

-Turn in: Near the start of the last line you should see -bc. How could this happen? - -

-This completes the homework. - - - - - - - - -- cgit v1.2.3