Download Embedded Xinu Documentation

Transcript
Embedded Xinu Documentation, Release master
Sleep
Modify system/sleep.c, system/wakeup.c, system/insertd.c, and system/clockintr.c to add
the sleep() system call to the operating system. A process that calls sleep(n) should enter the PRSLEEP state
for n clock ticks. A clock “tick” is one millisecond in our current system. It corresponds to the raising of the timer
interrupt request when interrupts are not disabled. When the clock interrupt handler detects that a process has slept for
long enough, the wakeup function should move the process back to the ready list.
The appropriate data structure for maintaining a list of sleeping processes is a delta queue, as described in lecture.
Add a delta queue to the system by increasing the QENT constant in include/queue.h, declaring a queue called
“sleepq” in include/clock.h, and and defining and initializing sleepq in system/clockinit.c. Make
sure to test your delta queue in isolation before testing the sleep() function.
Grading
Project credit will be weighted evenly between delta queue maintenance, sleeping, and waking processes. By now,
you should be aware that rigorous testing is the key to success in these projects. Our test cases will include at least:
• Checking your delta queue insert function with a variety of parameters
• Checking your sleeping and waking functions independently and in concert.
6.10.10 Assignment: Heap Memory
This assignment is a Xinu assignment allowing the student to more firmly understanding of how an operating system
works. This assignment is part of the Student Built Xinu track for professors that are teaching with Xinu. The entire
working directory containing your Xinu operating system will be submission for this assignment.
Preparation
First, make a fresh copy of your work thus far. cp -R Untar the new project files on top of this new directory: tar xvzf
You should now see the new project files in with your old files. Be certain to make clean before compiling for the first
time.
Getmem and Freemem
The files include/memory.h and system/initialize.c define and initialize a free list of available memory
blocks on the heap. Implement system/getmem.c and system/freemem.c to dole out blocks of requested
memory and properly maintain the free list. Use First Fit with simple compaction. (Compaction is the “stretch”
problem in this assignment – get everything else working first.)
Delete the file system/getstk.c and replace the lone call to this function in system/create.c with a proper
call to getmem() instead. Modify system/kill.c to call freemem() to deallocate a process stack when a
process dies.
Grading
Project credit will be divvied up evenly between getting memory, freeing memory, and compaction. By now, you
should be aware that rigorous testing is the key to success in these projects. Our test cases will include at least:
• Verifying that your getmem() and freemem() functions operate correctly over a variety of request sizes
6.10. Assignments
139