<< Chapter < Page Chapter >> Page >

Phase 3 – ipc primitives (semaphores) (10%)

  1. 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.
  2. 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

  1. 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%)
  2. 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

what is mutation
Janga Reply
what is a cell
Sifune Reply
how is urine form
Sifune
what is antagonism?
mahase Reply
classification of plants, gymnosperm features.
Linsy Reply
what is the features of gymnosperm
Linsy
how many types of solid did we have
Samuel Reply
what is an ionic bond
Samuel
What is Atoms
Daprince Reply
what is fallopian tube
Merolyn
what is bladder
Merolyn
what's bulbourethral gland
Eduek Reply
urine is formed in the nephron of the renal medulla in the kidney. It starts from filtration, then selective reabsorption and finally secretion
onuoha Reply
State the evolution relation and relevance between endoplasmic reticulum and cytoskeleton as it relates to cell.
Jeremiah
what is heart
Konadu Reply
how is urine formed in human
Konadu
how is urine formed in human
Rahma
what is the diference between a cavity and a canal
Pelagie Reply
what is the causative agent of malaria
Diamond
malaria is caused by an insect called mosquito.
Naomi
Malaria is cause by female anopheles mosquito
Isaac
Malaria is caused by plasmodium Female anopheles mosquitoe is d carrier
Olalekan
a canal is more needed in a root but a cavity is a bad effect
Commander
what are pathogens
Don Reply
In biology, a pathogen (Greek: πάθος pathos "suffering", "passion" and -γενής -genēs "producer of") in the oldest and broadest sense, is anything that can produce disease. A pathogen may also be referred to as an infectious agent, or simply a germ. The term pathogen came into use in the 1880s.[1][2
Zainab
A virus
Commander
Definition of respiration
Muhsin Reply
respiration is the process in which we breath in oxygen and breath out carbon dioxide
Achor
how are lungs work
Commander
where does digestion begins
Achiri Reply
in the mouth
EZEKIEL
what are the functions of follicle stimulating harmones?
Rashima Reply
stimulates the follicle to release the mature ovum into the oviduct
Davonte
what are the functions of Endocrine and pituitary gland
Chinaza
endocrine secrete hormone and regulate body process
Achor
while pituitary gland is an example of endocrine system and it's found in the Brain
Achor
what's biology?
Egbodo Reply
Biology is the study of living organisms, divided into many specialized field that cover their morphology, physiology,anatomy, behaviour,origin and distribution.
Lisah
biology is the study of life.
Alfreda
Biology is the study of how living organisms live and survive in a specific environment
Sifune
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




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.

Notification Switch

Would you like to follow the 'Operating systems' conversation and receive update notifications?

Ask