-
Home
- Operating systems
- Projects
- Project 5: multi-programming,
Phase 3 – ipc primitives (semaphores) (10%)
- Implement the
int CreateSemaphore(char *name, int
semval) system call. You will have to update start.s and syscall.h to
add the new system call signatures. You will create a container at the systemlevel that can hold upto 10 named semaphores. The CreateSemaphore system callwill return 0 on success and –1 on failure. The CreateSemaphore system call will
fail if there are not enough free spots in the container, the name is null, orthe initial semaphore value is less than 0.
- Implement
int wait(char *name) and int signal(char
*name) system calls.
Make sure you follow the wait and
signal as the mnemonics for these two and not down and up or P and V. The name parameter is the name of the semaphore. Both system calls return 0 onsuccess and –1 on failure. Failure can occur if the user gives an illegal
semaphore name (one that has not been created).
Phase 4 –priority scheduling&Simple aging
Required Reading –
-
Thread.h / .cc – The thread class has methods like Yield, Sleep,
Finish to manage the scheduling of threads. Understand of this class isessential to proceed.
-
List.h /.cc – Implementation of a Generic Linked List. Understand
the importance of the methods of this class clearly especially the SortedRemove&SortedInsert. The ready queue maintained by the scheduler is an object of
this type.
-
Scheduler.h / .cc – Implementation of the nachos thread scheduler&dispatcher. You will have to make the majority of your changes in this
class.
In this phase you will be implementing a policy that
schedules threads depending upon the priority that you set for threads using theExec(char * name, int priority) syscall. The details are as follows -
- Modify the thread scheduler to always return highest priority
thread. You will have to create another parameter in the Thread class– thepriority level of the thread represented by an integer value. The range of
thread priorities can be found in thread.h. Provide the appropriate tests inorder to demonstrate the success of your priority scheduling system.
Note: Enabling the –rs option for the test programs causes a thread to stop for context switching Yield the CPU to another thread (that could have lower
priority) after a given time slice. You might want to have a look at the Thread::Yield() method to take care of this.
(7%)
- Most priority scheduling solutions will starve out a low priority
thread. After you complete and test the above part, implement a simple agingsystem to take care of the starvation problem. Under this policy the priority of
a thread decreases one unit for every x times the thread is run. That is forevery x thread switches from ready to run, decrement the priority of the high
priority threads by 1. Specify x as a constant in your system, with the value -1indicating that aging is disabled. Add thread (“t”) debug statements to display
the trace of the aging algorithm. Provide the appropriate tests in order todemonstrate the success of your aging system.
(9%)
Phase 5 –putting it all together
- Implement a simple shell program to test your new system calls
implemented as above. The shell should take a command at a time, and run theappropriate user program. The shell should “Join” on each program “Exec”ed,
waiting for the program to exit. On return from the Join, print the exit code ifit is anything other than 0 (normal execution). Also, design the shell such that
it can run program in the background. Any command starting with character(&) should run in the background. (Ex:&create will run the test program
create program in the background.)
(6%)
- Solve the Dining Philosopher problem discussed in your text book.
Use Semaphore you designed for realizing mutual exclusion and synchronizationamong the philosophers.
(8%)
Documentation - Includes internal documentation, and
external documentation as described:
- How did you maintain a list of all processes in the system? What
other data structures did you require?
(3%)
- Explain the significance of the Join&Exit system calls. How
did you synchronize the 2 syscalls?
(4%)
- What changes did you make to implement Phase 4, and why?
(3%)
Questions & Answers
A golfer on a fairway is 70 m away from the green, which sits below the level of the fairway by 20 m. If the golfer hits the ball at an angle of 40° with an initial speed of 20 m/s, how close to the green does she come?
A mouse of mass 200 g falls 100 m down a vertical mine shaft and lands at the bottom with a speed of 8.0 m/s. During its fall, how much work is done on the mouse by air resistance
Can you compute that for me. Ty
Jude
what is the dimension formula of energy?
Chemistry is a branch of science that deals with the study of matter,it composition,it structure and the changes it undergoes
Adjei
please, I'm a physics student and I need help in physics
Adjanou
chemistry could also be understood like the sexual attraction/repulsion of the male and female elements. the reaction varies depending on the energy differences of each given gender. + masculine -female.
Pedro
A ball is thrown straight up.it passes a 2.0m high window 7.50 m off the ground on it path up and takes 1.30 s to go past the window.what was the ball initial velocity
2. A sled plus passenger with total mass 50 kg is pulled 20 m across the snow (0.20) at constant velocity by a force directed 25° above the horizontal. Calculate (a) the work of the applied force, (b) the work of friction, and (c) the total work.
you have been hired as an espert witness in a court case involving an automobile accident. the accident involved car A of mass 1500kg which crashed into stationary car B of mass 1100kg. the driver of car A applied his brakes 15 m before he skidded and crashed into car B. after the collision, car A s
can someone explain to me, an ignorant high school student, why the trend of the graph doesn't follow the fact that the higher frequency a sound wave is, the more power it is, hence, making me think the phons output would follow this general trend?
Nevermind i just realied that the graph is the phons output for a person with normal hearing and not just the phons output of the sound waves power, I should read the entire thing next time
Joseph
Follow up question, does anyone know where I can find a graph that accuretly depicts the actual relative "power" output of sound over its frequency instead of just humans hearing
Joseph
"Generation of electrical energy from sound energy | IEEE Conference Publication | IEEE Xplore" ***ieeexplore.ieee.org/document/7150687?reload=true
Ryan
what are the types of wave
Maurice
fine, how about you?
Mohammed
A string is 3.00 m long with a mass of 5.00 g. The string is held taut with a tension of 500.00 N applied to the string. A pulse is sent down the string. How long does it take the pulse to travel the 3.00 m of the string?
Who can show me the full solution in this problem?
Got questions? Join the online conversation and get instant answers!
Source:
OpenStax, Operating systems. OpenStax CNX. Aug 13, 2009 Download for free at http://cnx.org/content/col10785/1.2
Google Play and the Google Play logo are trademarks of Google Inc.