CSE 411 : Operating Systems (Spring 2006)
Project 1

DUE Feb. 23rd@02:00PM

This page will continue to be updated. Please check back periodically for updates and announcements.

Demo Signup Slots
Group Assignments
Implementation help
Shells and Editors
Description
Labs Usage
Library Interface
Scheduling Policies
Useful Tips
Frequently asked questions
Sample Programs

Description

In this project, you will learn about creating concurrent activities and scheduling these activities. As discussed in class, UNIX provides the notion of a "process" for an activity and switches between processes to support concurrent activities. The address space (code, data and stack) together with the registers and other state information constitute the state of a process, and these have to be saved and restored when the operating system switches from one process to another.

In this project, the unit of activity is a "thread" instead of a process. You will have a single UNIX process, and you will need to create several activities (threads) within this UNIX process and manage these threads. UNIX will still see this as one single process, and it is upto the library, that you develop which will provide the thread creation/termination/management routines to the user program. The interface routines of the library to be implemented are described below, and a brief sample of a user program using these routines is also given. Use the information given in this handout more as a higher level description of what you are expected to implement.

You should be able to switch from one thread to another on an explicit t_yield() call which a thread can invoke. Note that here, you need not switch the code and data since all the threads share the same code and data unlike processes. Only the stack, registers etc. need to be saved and restored. In addition, you should implement a round-robin scheduling scheme which switches between the threads with a time quantum of 10 milli-seconds. This round-robin scheduler should also use the priority of the thread when making scheduling decisions.

You need to implement a version of the counting semaphore for synchronization between the different threads.  The thread interface will include routines to create, P(down), V(up) and destroy a semaphore. The data structure for the semaphore needs to be defined : it is referred to by the type name sem_t .
 

Make sure you keep checking this web-site for any latest information/updates regarding the project. The updates will be highted in RED color. Also note that the test programs (ie. the user programs which will exercise the library you will implement) is made available at this web-site at the "sample programs" link. You should make sure that you use the same test programs (the interface should remain the same, and they should be compilable/linkable with your code).

Even though you will work in groups of up to three(individual projects are also allowed), each of you should be fully familiar with the entire code. You should also ensure that there is a fair division of labor between the members. The project report is due in class on February 23. The code needs to be submitted using the turning procedure(to be announced) on the due date before 02:00PM and there will be a 20% deduction for delays upto 24 hours and 40% deduction for delays upto 48 hours. Projects turned in after 48 hours of the posted deadline will not be graded. The report should include (a) a complete listing of your code, (b) a detailed description of your implementation, (c) design decisions and assumptions (with justifications) that you may have made, (c) breakdown of the contribution of each member of a team. You need to set up an appointment with the TA to demonstrate your implementation and answer a range of questions related to the entire project (even though an individual may have worked on only one part). The TA will use the test programs provided here for testing your code and may use other test programs as well.

top


Lab Usage :


You will be using labs 218 and 222 in IST building for your project.

218 lab usage is available at the following link
218 Lab usage

222 lab usage is available at the following link
222 Lab usage

top

Library Interface :

void t_init () ;

void t_shutdown () ; /* Initialize and shutdown the thread library.*/

tid_t t_create ( void (*func)(int) , int val , int pri ) ;/*Create a new thread with priority pri, start function func with argument val The t_create call returns the id of the thread created. The function func should be of the following type : void func ( int val ) ; */

void t_yield () ; /*Yield the CPU. ie. the current thread is volunarily relinquishing the CPU. */

int t_join(tid_t id) ; /*Suspends execution of calling thred until thread with thread-id id terminates. Returns 1 on success */

int t_terminate () ; /*Terminate the current thread.*/

int sem_init (sem_t *sp, unsigned int sem_count) ; /*Create a new semaphore pointed to by sp with a count value of sem_count*/

void sem_wait (sem_t *sp) ; /* Current thread does a wait on the specified semaphore */

void sem_signal (sem_t *sp) ; /*Current thread does a signal operation on the specified semaphore */

void sem_destroy (sem_t *sp) ; /* Destroys any state related to specified semaphore */

top


Scheduling Policies :

top

Useful Tips:

top