Skip to content

Changy-/OS-course

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OS-course

Projects of 2016 fall OS course

##1.Shell Program - Programming assignment

Implement a simple command line shell program in C that interacts with the user in the following way. By default, the shell gives a prompt to the user. When the user types in a command (in response to its prompt) and hits Enter, the shell creates a child process that executes the command he entered and displays the results if any. It then prompts for more user input by displaying the prompt again.

For example, when the user types command ls, the shell should display a listing of files in the current working directory. Your program should achieve this by simply passing this command to the underlying shell and receiving the results generated by it. Do not try to implement the functionality of the command within your own program.

The shell can be limited to handling basic commands that do not involve piping and redirection.

##2.Multithreading - Programming Assignment

Study the example program in the attached file. This program creates a new thread. Both the main thread and the new thread then increment the variable counter infinitely. After incrementing the value of counter, each thread prints a message showing the value of the variable. One of the threads exits when it finds that the counter value has exceeded 25. Run the program and explain the output. Why do the print statements stop appearing after a certain point in the program ? Explain.

Compile and run the program on a Linux system. Find out what results it produces and explain the results. Compile as follows:

$ gcc assignment_multithreading.c -o assignment_mt -lpthread 

Run using the following command

$ ./assignment_mt

Modify the program and write a correct version that fixes the problem that you just discovered. Explain how you fixed the program.

##3.Shared Memory - Programming Assignment

Write two simple C programs that communicate with each other via shared memory. The first program receiver.c runs in an infinite loop receiving alpha numeric strings as input from the user, one line at a time. After reading one line from the standard input, this program sends this information to the other program only if the line contains the secret code "C00L". The sharing of data between the two processes should take place via shared memory. The second program processor.c creates an output file secrets.out and waits for user input to be sent by the receiver program. As soon as one line is received from the receiver, it counts the number of digits in that line and dumps the digit count along with the original line in the secrets.out file. This program also runs in an infinite loop.

##4.Sockets and Signals- Programming assignment

Modify the program described in Assignment 3 in such a way that the two programs can be run on different machines. The program receiver.c will now be the client program that will interact with the user. Call it client.c. The processor.c will be the backend program – call it server.c. The client and server programs have the same functionality as described in Assignment 3 except that they should use sockets as a communication mechanism that will allow the client and the server to be run on different machines.

When the user presses Ctrl-C on the server.c terminal, the server program should display a summary, which should show the number of lines received so far and the total digit count across all input seen by the server.

##5.Remote Procedure Call - Distributed System

Modify the program described in Assignment 3 in such a way that the two programs can be run on different machines using Remote Procedure Calls (RPC). Remote procedure calls allow programs to make procedure calls into remote programs running on a different machine across the network and are therefore fundamental in building a distributed system. The receiver.c and the processor.c have the same functionality as described in Assignment 3 except that they should use remote procedure calls to communicate and achieve the same functionality.

About

Projects of 2016 fall OS course

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published