Operating System Lab Assignments


Day 1

1.      Practice all the below mentioned commands with all possible options cd, cat, ls, ln,dir, mkdir, rmdir, pwd, mv,cp, rm, ps, kill and jobs
2.      Enter the two commands echo * and ls? What do you think echo did?
3.      Enter the commands echo “$SHELL” and echo ‘$SHELL’. What difference do you notice?
4.      Which ls option marks directories and executables separately?
5.      How will you obtain a complete listing of all files and directories in the whole system?
6.      What does cd do when used without arguments?
7.      What will rm –fi * do?
8.      How will you copy a directory structure bar1 to bar2?
9.      When will cd * work?
10.  Practice all vi editor commands.
11.  In vi editor how will you partially overwrite the contents of a line?
12.  How will you quickly move to the fifth word of a line, and replace its four characters with something else?
13.  How do you move to the 20th line, and then copy that line and the remaining lines to a separate file?

Day 2

1.      Write a sort sequence to order emp.lst on the month of birth
2.      How will you read a file backwards?
3.      Generate a code list by selecting the departments from emp.lst
4.      How will you remove duplicates from a file?
5.      What does grep “^\*” do?
6.      How will you list the ordinary files in your current directory that are not writable?
7.      How is chown different from chgrp when it comes to renouncing ownership?
8.      Develop a shell script for adding 10 numbers
9.      Develop a shell script to print date

Day 3

1.      Redirect the standard error so as to append it to a file myerror.txt
2.      Set the permissions of any one of your files to have all permissions for yourself, read and execute permissions for your group and only execute permissions for others. Also set the sticky bit and the group id permissions for the same using symbols as well as the absolute method.
3.      What command lists the lines in the file "testfile.txt" containing the word "file", with a line number at the beginning of each line? (Hint: There could be 2 answers, One answer with UNIX pipe and another without UNIX pipe) 
4.      What command lists the lines containing the word "file" in the files "lab1", "lab1a", and "lab1b" on your screen using single command? 

Day 4

1.      Develop shell scripts using for & until constructs for adding n numbers
2.      Develop a shell script to compare two numbers and print the largest, Give the numbers from the command line
3.      Develop a shell script which prints a no (1 to 10) in words (2 – two) using case construct
4.      Develop a shell script for adding two given numbers using functions construct. Two numbers are given as arguments to the function
5.      What is the use of PATH variable?

Day 5

1.      Practice all the below mentioned commands with all possible options chmod, find, head, more, tail, & chgrp
2.      Redirect the standard error so as to append it to a file myerror.txt
3.      How will you obtain a complete listing of all files and directories in the whole system?
4.      Develop a shell script to add n numbers using while loop

Day 6

1.      How do you decrease the priority of a particular process?
2.      How do you schedule a process, which should wish you happy birthday on each of your birthday throughout the rest of your life?
3.      How will you find out which processes have been launched from a specific terminal?
4.      Implement preemptive priority scheduling algorithm

Day 7

1.      While executing a shell script either the LOGNAME or the UID is supplied at the command prompt. Write a shell script to find out at how many terminals has this user logged in?
2.      An integer is input through the keyboard. Write a program to find out whether it is an odd number or even number
3.      Write a shell script, which receives any year from the keyboard and determines whether the year is a leap or not. If no argument is supplied the current year should be assumed
4.      Implement LRU page replacement algorithm

Day 8

1.      Implement file system in C language by using tree data structure

Day 9

1.       Write a C program in Linux that opens an input file for reading and an output file for writing. The names of the files should be command line arguments.
2.       Implement a function that uses the C standard I/O library (stdio) functions getc and putc to copy the input file to the output file one character at a time
3.       Implement a C program that uses lseek system call to copy the contents of one file into another file at position 100.
4.       Develop a program using file system calls (open, create, read, link, write, lseek, close, unlink) that determines the length of a file without using a loop in the code


Day 10

1.       Develop a program which makes use of fork system call and give your observations
2.       Develop a program that does the following. Creates 2 processes, a parent and a child using fork(). The parent prints the value of I from 0 to 1000 and then exits. The child process sleeps for a second after it is created, sends a SIGUSR1 signal to the parent and then exits. The parent could catch that signal, print the value of I at that instant, sleep for a second and then continue.

Day 11

1.      Develop a program with race condition problem
2.      Develop a program which solves the race condition problem using semaphores
3.      Develop a program, which creates 2 processes (p1 & p2). Code in process p1 needs to be executed first and then it has to go to process p2. Implement this using semaphore

Day 12

1.      Develop a program to execute ls | wc –l command by using pipe system call as well as using popen & close function calls
2.      Develop a sample application where FIFO is used for inter process communication
3.      In an environment there are n instances of one specific resource type (for e.g. 5 instances of printer resource type). Provide synchronization-using semaphores in using these n instances among m processes (m>n).

Day 13

1.      Develop a program where a single writer process will send messages to n number of reader processes. Write process along with message, also attaches the reader no who has to read it through type variable. Reader process reads messages referred to that process by using type variable. Use message queue for IPC
2.      Solve producer consumer problem with pthreads using semaphores

Day 14

1.      Develop a program to display the host name of a machine
2.      Develop a simple file transfer distributed application using sockets

Day 15

1.      Develop a text based chat distributed application using sockets (make multi process server)
2.      Develop unix based socket application. Server is an arithmetic server which provides services like +, - , * and /

Day 16

1.      Practice the usage of memory management system calls
2.      Request IRQ of Linux keyboard interrupt and print your own message

Day 17
1.    Develop sample applications by using the system call interface and print the time required to execute the system call functionality. Execute the same application on both Linux and RTLinux and give your observations on timing requirements

Day 18

1.      Create a periodic RT task with period 2 sec. Determine the scheduling jitter of the task.
2.      Repeat 1 for 3 tasks of different priorities and same period.
3.      Create 2 RT tasks with different priorities contending for the same resource (mutex).
4.      Repeat 3 using trylock instead of lock.
5.      Create a linux process that reads data sent by an RT task using a RT-FIFO.

Day 19

1.      Create a linux process that writes data into a RT FIFO. The RT task reads data from the FIFO. (NB. You are required to write a FIFO handler in this case).
2.      Create a RT-FIFO of size 2KB. A RT task should continuously write to this buffer till possible. If buffer is full it should wait for 2 sec and then attempt again. A user process should read this 2KB data at a time and print a message after reading 10KB data.
3.      A user process is used to control the operations of a RT task. 2 RT-FIFO’s are used for communication. One acts as command FIFO and other as data FIFO. The user process issues commands ‘start’, ‘stop’ and ‘resume’ to start, suspend and resume the execution of a RT task. Whenever the RT-task executes it writes into the data FIFO. This data is read and displayed by the user process.
4.      Program a Real Time Clock (IRQ 8) to generate periodic interrupts. Determine the time period of the clock using a RT task.
5.      Write a program to generate blinking LEDs. The LED’s should be connected to a parallel port. Data is written to the port at each timer interrupt generated by an RTC.

Day 20

1.    Installation of RTLinux


Post a Comment

0 Comments