0% found this document useful (0 votes)
114 views8 pages

UOS Ass List 2012 13

This document provides an assignment list for a UNIX operating systems course. It includes 7 assignments covering various UNIX concepts like processes, signals, file systems, threads, shell scripting, semaphores, and message queues. For each assignment, objectives are stated and multiple problems labeled as basic (B), intermediate (I), or expert (E) are provided. Students must complete at least two problems for each assignment, with bonus marks given for completing all. The problems involve writing programs using various UNIX system calls and library functions to demonstrate understanding of the related concepts. Sample references and links are also sometimes included.

Uploaded by

Shikari 1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
114 views8 pages

UOS Ass List 2012 13

This document provides an assignment list for a UNIX operating systems course. It includes 7 assignments covering various UNIX concepts like processes, signals, file systems, threads, shell scripting, semaphores, and message queues. For each assignment, objectives are stated and multiple problems labeled as basic (B), intermediate (I), or expert (E) are provided. Students must complete at least two problems for each assignment, with bonus marks given for completing all. The problems involve writing programs using various UNIX system calls and library functions to demonstrate understanding of the related concepts. Sample references and links are also sometimes included.

Uploaded by

Shikari 1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

UNIX Operating System

Assignment list
Note:
1. All programs on Linux using either in C/JAVA/Shell programming/python.
2. Write up should stick to program objective (title, subtitle, theory, application system
call, system call used, variable/data dictionary flowcharts and conclusions). Sample
template is given at the end of the assignment list. Use appropriate tool like
BAKOMA, Lyx, winedit etc. (Lyx Template will be available on ftp/moodle)
3. Write up should stick to program objective (theory, system call used, variable
dictionary and application system call)(soft copy submission allowed in latex only)
4. Submit any two from a, b, c… if you solve all, bonus mark will be given.
5. Assignment 10, 11 and 12 are optional.

Sr. no. Assignments

1. Processing Environment: fork, vfork, wait, waitpid(),exec (all variations


exec), and exit,
Objectives:
1.To learn about Processing Environment.
2. To know the difference between fork/vfork and various execs
variations.
3. Use of system call to write effective programs.

a. Write the application or program to open applications of Linux by


creating new processes using fork system call. Comment on how
various application’s/command’s process get created in linux. (B)
b. Write the application or program to create Childs assign the task
to them by variation exec system calls. (B)
c. Write the program to use fork/ vfork system call. Justify the
difference by using suitable application of fork/vfork system calls.
(I)
d. Write the program to use wait/ waitpid system call and explain
what it do when call in parent and called in child (). Justify the
difference by using suitable application. (I)
http://www.yolinux.com/TUTORIALS/ForkExecProcesses.html
e. Write the program to use fork/ vfork system call and assign
process to work as a shell. OR Read commands from standard input and
execute them. Comment on the feature of this programe. (E)

2. IPC: Interrupts and Signals: signal(any fives type of signal ), alarm, kill,
raise, killpg, signal , sigaction, pause

Objectives:
1. To learn about IPC through signal.
2. To know the process management of Unix/Linux OS
3. Use of system call to write effective application programs.

a. Write application or program to use alarm and signal system calls


such that, it will read input from user within mentioned time (
say10 seconds) ,otherwise terminate by printing message. (B)
b. Write a application or program that communicates between child
and parent processes using kill() and signal().(I)
c. Write a application or program that communicates between to
process opened in two terminal using kill() and signal().(I)
d. Write application or program to trap a ctrl-c but not quit on this
signal. (E)
e. Write a program to send signal by five different signal sending
system calls and identify the difference in working with example.
(E)
f. Write application of signal handling in linux OS and program any
one. (E)
Ref: ftp://10.1013.3/pub/UOS..../ OR
Ref:www.cs.cf.ac.uk/Dave/C/CE.html OR
System call search
Signal.ppt
3. A. File system Internals: stat, fstat, ustat, link/unlink, dup
Objectives:
1. To learn about File system Internals.

a. Write the program to show file statistics using the stat system call.
Take the filename / directory name from user including path. (B)
b. Write the program to show file statistics using the fstat system
call. Take the file name / directory name from user including path.
Print only inode no, UID, GID, FAP and File type only. (B)
c. Write a program to use link/unlink system call for creating logical
link and identifying the difference using stat. (I)
d. Implement a program to print the various types of file in Linux.
(Char, block etc.) (E)
Ref: System call search
B. File locking system call : fnctl.h: flock/lockf (Optional)
Objectives:
1. To learn about File locking-mandatory and advisory
locking.

a. Write a program to lock the file using lockf system call.


Check for mandatory locks, the file must be a regular file
with the set-group-ID bit on and the group executes
permission off. If either condition fails, all record locks
are advisory. (E)

b. Write a program to lock the file using flock system call.


(E)
c. write a program to lock file using fnctl system call(E)
Ref: http://techpubs.sgi.com/library/dynaweb_docs/0530/SGI_Developer/boo...
http://docs.oracle.com/cd/E19963-01/html/821-1602/fileio-9.html
Book : Programming Interfaces Guide Beta, Oracle, chapter no 6.

4. Thread concept: clone, threads of java


Objectives:
1. To learn about threading in Linux/Unix and Java and difference
between them..
2. Use of system call/library to write effective programs.

a. Write a multithreaded program in java/c for chatting (multiuser


and multi-terminal) using threads. (B)
b. Write a program which creates 3 threads, first thread printing
even number, second thread printing odd number and third thread
printing prime number in terminals. (B)
1. Write program to synchronize threads using construct –
monitor/serialize/semaphore of Java (In java only) (I)
c. Write a program in Linux to use clone system call and show how
it is different from fork system call. (I)
d. Write a program using p-thread library of Linux. Create three
threads to take odd, even and prime respectively and print their
average respectively. (In C) (I)
Ref:http://www.yolinux.com/TUTORIALS/LinuxTutorialPosixThreads.html#BASICS
e. Write a program using p thread library of Linux. Create three
threads to take numbers and use join to print their average. (in C)
(E)
Ref:http://www.yolinux.com/TUTORIALS/LinuxTutorialPosixThreads.html#BASICS
f. Write program to synchronize threads using construct –
monitor/serialize/semaphore of Java (In java only) (E)
g. Write program using semaphore to ensure that function f1 should
executed after f2. (In java only) (E)
Ref: ftp://10.1013.3/pub/UOS..../
System call search

5. Shell programming: shell scripts


Objectives:
1.To learn shell programming and use it for write effective
programs.
a. Write a program to implement a shell script for calculator (B)
b. Write a program to implement a digital clock using shell script.
(B)
c. Using shell sort the given 10 number in ascending order (use of
array). (B)
d. Shell script to print "Hello World" message, in Bold, Blink effect, and
in different colors like red, brown etc. (B)
e. Shell script to determine whether given file exists or not. (I)
Ref: ftp://10.1013.3/pub/UOS..../
f. Import python script in shell script. (E)
6. IPC:Semaphores: semaphore.h-semget, semctl, semop.
Objectives:
1. To learn about IPC through semaphore.
2. Use of system call and IPC mechanism to write effective
application programs.

a. Write a program to illustrate the semaphore concept. Use fork so


that 2 process running simultaneously and communicate via
semaphore. (B)
Ref:http://www.cs.cf.ac.uk/Dave/C/node26.html#SECTION002600000000000000000
Ref: ftp://10.1013.3/pub/UOS..../ OR
Ref:www.cs.cf.ac.uk/Dave/C/CE.html OR
System call search
b. Write a program to implement producer consumer problem. (Use
suitable synchronization system calls fromsem.h/semaphore.h or
semaphore of Java) (I)
c. Write two programs that will communicate both ways (i.e each
process can read and write) when run concurrently via
semaphores. (E)
d. Write 3 programs separately, 1st program will initialize the
semaphore and display the semaphore ID. 2nd program will
perform the P operation and print message accordingly. 3rd
program will perform the V operation print the message
accordingly for the same semaphore declared in the 1st program.
(E)Ref.:http://www.minek.com/files/unix_examples/semab.html

7. IPC: Message Queues: msgget, msgsnd, msgrcv.


Objectives:
1. To learn about IPC through message queue.
2. Use of system call and IPC mechanism to write effective
application programs.
a. Write a program to perform IPC using message and send did u get
this? and then reply. (B)
b. Write a 2 programs that will both send and messages and
construct the following dialog between them
 (Process 1) Sends the message "Are you hearing me?"
 (Process 2) Receives the message and replies "Loud and Clear".
 (Process 1) Receives the reply and then says "I can hear you too".
(I)
c. Write a server program and two client programs so that the server
can communicate privately to each client individually via a single
message queue. (E)
Ref: ftp://10.1013.3/pub/UOS..../ OR
Ref:www.cs.cf.ac.uk/Dave/C/CE.html OR
System call search
8. IPC: Shared Memory: (shmget, shmat, shmdt)
Objectives:
1. To learn about IPC through message queue.
2. Use of system call and IPC mechanism to write effective
application programs.
a. Write a program to perform IPC using shared memory to illustrate
the passing of a simple piece of memory (a string) between the
processes if running simultaneously. (B)
b. Write 2 programs that will communicate via shared memory and
semaphores. Data will be exchanged via memory and semaphores
will be used to synchronize and notify each process when
operations such as memory loaded and memory read have been
performed. (I)
c. Write 2 programs. 1st program will take small file from the user
and write inside the shared memory. 2nd program will read from
the shared memory and write into the file. (E)
Ref: ftp://10.1013.3/pub/UOS..../ OR
Ref:www.cs.cf.ac.uk/Dave/C/CE.html OR
System call search

9. IPC: Sockets: socket system call in C/socket programming of Java


Objectives:
1. To learn about fundamentals of IPC through C socket
programming.
2. Learn and understand the OS intraction with socket
programming.
3. Use of system call and IPC mechanism to write effective
application programs.
4. To know the port numbersing and process relation.
5. To knows the iterative and concurrent server concept.
a. Write two programs (server/client) and establish a socket to
communicate. (In Java only) (B)
Ref:http://www.prasannatech.net/2008/07/socket-programming-tutorial.html
b. Write programs (server and client) to implement
concurrent/iteraitve server to conntect multiple clients requests
handled through concurrent/iterative logic using UDP/TCP socket
connection.( C or Java only) (use process concept for c server and
thread for java server) (B)
c. Write two programs (server and client) to show how you can
establish a TCP socket connection using the above functions.(in C
only) (in exam allowed to do in java and python) (I)
Ref:http://www.prasannatech.net/2008/07/socket-programming-tutorial.html
d. Write two programs (server and client) to show how you can
establish a UDP socket connection using the above functions.(in
C only) (I)
Ref:http://www.prasannatech.net/2008/07/socket-programming-tutorial.html
Ref: pdfbooks given
e. Implement echo server using TCP/UDP in iterative/concurrent
logic. (E)
f. Implement chating using TCP/UDP socket (between two or more
users.) (E)
Other programs are at:
Ref: ftp://10.1013.3/pub/UOS..../ OR
Ref:www.cs.cf.ac.uk/Dave/C/CE.html OR
System call search
10. Python: As a scripting language (Optional)
Objectives:
1. To learn about python as scripting option.

a. Write a program to display the following pyramid. The number of


lines in the pyramid should not behard-coded. It should be
obtained from the user. The pyramid should appear as close to the
centreof the screen as possible. (B)

(Hint: Basics n loops)


b. Write a python function for prime number input limit in as
parameter to it. (B)
Ref: ftp://10.1013.3/pub/UOS..../python by AJU
c. Take any txt file and count word frequencies in a file.(hint : file
handling + basics ) (I)
d. Generate frequency list of all the commands you have used, and
show the top 5 commands along with their count. (Hint: history
command will give you a list of all commands used.) (I)
e. Write a shell script that will take a filename as input and check if
it is executable. 2. Modify the script in the previous question, to
remove the execute permissions, if the file is executable. (E)
f. Generate a word frequency list for wonderland.txt. Hint: use grep,
tr, sort, uniq (or anything else that you want) (E)
g. Write a bash script that takes 2 or more arguments,
i)All arguments are filenames
ii)If fewer than two arguments are given, print an error message
iii)If the files do not exist, print error message
iv)Otherwise concatenate files (E)
h. Write a python function for merge/quick sort for integer list as
parameter to it. (E)

11. IPC: MPI(C library for message passing between processes of different
systems) Distributed memory programming. (Optional)
Objectives:
1. To learn about IPC through MPI.
2. Use of IPC mechanism to write effective application
programs.

a. Implement the program IPC/IPS using MPI library.


Communication in processes of users. (B)
b. Implement the program IPC/IPS using MPI library.
Communication in between processes OS’s: Unix. (I)
c. configure cluster and experiment MPI program on it. (E)
Ref: ftp://10.10.13.16/pub/Academic_Material/TYIT/Semister_2/Unix_Operating_System/OpenMP.....
OR
Search on internet
12. OpenMP: (C library for Threading on multicore) shared memory
programming. (Optional)
Objectives:
1. To learn about openMP for better use multicore system.
a. Implement the program for threads using Open MP library. Print
number of core. (B)
b. Implement the program OpenMP threads and print prime number
task, odd number and Fibonacci series using three thread on core.
Comment on performance CPU. (I)
c. Write a program for Matrix Multiplication in OpenMP. (E)
Ref: ftp://10.10.13.16/pub/Academic_Material/TYIT/Semister_2/Unix_Operating_System/OpenMP.....
OR Search on internet
13. STREAMS message/PIPEs/FIFO:pipe, popenand pcloseFunctions
(Optional)

a. Send data from parent to child over a pipe. (B)


b. Filter to convert uppercase characters to lowercase. (B)
c. Simple filter to add two numbers. (B)
d. Invoke uppercase/lowercase filter to read commands. (I)
e. Filter to add two numbers, using standard I/O. (E)
f. Client–Server Communication Using a FIFO. (E)
Ref: advanced network programming- Stevens .pdf
g. Routines to let a parent and child synchronize. (E)

A.J.Umbarkar, Course Teacher

Template of write-up (for word) (all in times new roman)


Assignment No: 1(a) (size 12)
Title: (size 12 bold) IPC: Shared Memory
Subtitle: (12 normal) write a program to perform IPC using shared memory to illustrate the
passing of a simple piece of memory (a string) between the processes if running simultaneously.
Theory: (12 normal) text (12 normal)
shmget, shmat, shmdt details.
Data/Varables dictionary:
Sr. NAME OF TYPE USE WHERE THE
No. VARIABLE/FUNCTION/STRUCT VARIABLE IS
CALLED
1 STRUCT ABC STUCT/UNION FOR SOCKET
TUPLE
2 STRUCT SEM UNION FOR SEMAPHORE
3 Sem_id int Semaphore id

Flowcharts: (12 normal) server / client separately

Conclusions: (12 normal)


1. Learn to use
2. Learn the os nework interaction
3. Learn system call
4. Etc.

You might also like