Submit: Turn in your
create.c
, ctxsw.S
, and
testcases.c
source files using the
turnin command on morbius.mscsnet.mu.edu or
one of the other
Systems Lab machines.
Work should be completed in pairs. Be certain
to include both names in the comment block at the top of all
source code files. It would be courteous to confirm with your
partner when submitting the assignment. You may modify any files
in the operating system, but only changes to
ctxsw.S
, create.c
and testcases.c
will be graded for this assignment.
First, make a copy of your Project 3 directory:
cp -R xinu-hw3 xinu-hw4
Then, untar the new project files on top of it:
tar xvzf ~brylow/os/Projects/xinu-hw4.tgz
New files:
system/initialize.c Updated initialization for Project 4. system/main.c A "main program" for testing scheduling. system/queue.c An implementation of the queue data structure. system/create.c A partial function for creating a new process. system/ctxsw.S An incomplete assembly routine for switching process contexts. system/ready.c An complete function for adding a process to a ready queue. include/proc.h Process table declarations and constants. include/queue.h Process queue entries. include/kernel.h Definitions of XINU standard function prototypes such as kprintf(). include/xinu.h Includes all necessary XINU header files. include/stddef.h Various standard XINU type definitions. compile/Makefile Updated rules for compiling XINU.
The create() and ctxsw() functions are incomplete and must be filled in. The major locations are marked with "// TODO... ." File system/testcases.c contains code to test your create() and ctxsw() with three processes, each of which prints a process ID and then yields. Once your creation and context switch functions are working, you will see these three processes take turns running on multiple cores.
An operating system's context switch function typically must be written in assembly language because the low level manipulations it performs are not modeled well in higher-level languages. If you have not worked in ARM assembly language before, there are many helpful resources available online. Despite its low-level nature, a context switch does not require complex instructions. Our context switch can be completed using only arithmetic opcodes, and the load (ldr), store (str), and move (mov) opcodes.
Please refer to ARM Information Center for a useful explanation of general ARM syntax.
Note: The Raspberry Pi 3 Model B+ is equipped with a ARM Cortex A-53 processor, which implements the ARMv8-A instruction set. While it is 64-bit-capable, XINU uses its 32-bit instruction set for simplicity.
The default test case provided with the tarball is necessary, but not sufficient. Just because it switches between a handful of identical processes does not guarantee correctness. In embedded systems, details matter. (A LOT!) Students in previous terms have found that subtle bugs in this phase of the term project were responsible for nightmares weeks and months down the line. Test your code thoroughly:
You have a working I/O driver, and a kprintf() function for formatted output. Use these to explore every aspect of the operating system structures you are building.
[Revised 2020 Sep 17 09:54 DWB]