Professional Documents
Culture Documents
2018-19 A CS500NI1 A3 CW Coursework17031035 Renish Gautam
2018-19 A CS500NI1 A3 CW Coursework17031035 Renish Gautam
I confirm that I understand my coursework needs to be submitted online via Google Classroom
under the relevant module page before the deadline in order for my assignment to be accepted
and marked. I am fully aware that late submissions will be treated as non-submission and a
marks of zero will be awarded.
Table of Contents
Acknowledgement .......................................................................................................................... 1
Abstract ........................................................................................................................................... 2
Task A ............................................................................................................................................. 3
Introduction ................................................................................................................................. 3
Script ........................................................................................................................................... 4
Testing: ...................................................................................................................................... 11
Conclusion................................................................................................................................. 28
Task B ........................................................................................................................................... 29
Introduction ............................................................................................................................... 29
Conclusion .................................................................................................................................... 35
References ..................................................................................................................................... 36
Appendix ....................................................................................................................................... 38
Table of Figures
Figure 5 Test result after entering a number of a chosen code from the list of players. ............... 15
Figure 8 Result after entering name and id through parameter of program .................................. 18
Figure 9 Result for entering the wrong code name and selecting that option............................... 19
Figure 10 Result after entering the invalid secret key three times. ............................................... 20
Figure 12: Result after entering not the best team ........................................................................ 22
Figure 17: Result after entering player code more than 3 times .................................................. 27
Table of Tables
Acknowledgement
It is my proud privilege to express a pleasure to remind the fine individuals in the Islington College
for their sincere supervision. I acknowledged to uphold my theoretical as well as practical skills in
the lecture, tutorial and workshop session.
First of all, I would like to express my special thanks of gratefulness to our module leader Mr.
Dipeshor Silwal for providing timely guidance and clear vision about the topics related to the
Network and operating system.
Secondly, I would like to express my deepest thanks to our tutor Mr. Suryansh Mathema for
providing invaluable guidance and encouragement throughout the semester. He has been very
helpful in dealing with the queries of this module along with the coursework.
I’m very thankful to all the faculties’ member of Islington College for co-ordination and
cooperation and for their kind supervision along with inspiration.
Lastly, I would like to thank my friends and seniors who helped me in concluding the project
within the limited time frame.
Abstract
This coursework consists of two portions Task A and Task B. Task A part of the coursework
requires us to develop a script in the environment of UNIX shell. Completion of this ask requires
us to construct an interactive request, check for user input errors, diagnosis of the errors with clear
messages and testing of the script. As for Task B part of the coursework we are to write a technical
report on UNIX as a network operating system. This report is to be based on the research form
books, journals, industry white papers, websites and textbooks.
Task A
Introduction
UNIX has a special utility known as shell which interprets all the commands from the terminal
and runs the requested program by the user. This coursework requires to develop a small script
program in a UNIX shell environment. Task A of the coursework requires to create and script and
also perform a black box testing for valid and invalid inputs. Task A also requires the content of
the three files which is used by script program for reading the contents from them.
Aims
• To develop a script that implements interaction with the UNIX environment in a friendly
manner and executes simple input/output operations.
• To construct an interactive request by using UNIX commands.
• To check user inputs for errors and diagnosing these errors with clear messages.
• To test the script for valid and invalid inputs.
Objectives
• By writing a program using different UNIX shell command.
• By researching about the different interactive commands and implementing it in the script
program and making good use of if, while, select, read, case, until commands.
• By using different utilities like echo and cat to display messages and read files
respectively.
• By using black box testing to carry out testing for each valid and invalid input testing.
Script
#!/bin/bash
hello(){
echo "Welcome $name"
echo "ID number: $ID"
echo "Current date and time: "$(date)
}
#This function displays the country name and code and then asks to enter best
team
view1(){
echo "Country: || Code:
"
echo "Japan || JPN
Argentina || ARG
Germany || GER
France || FRA
Brazil || BRA
"
}
ask1(){
echo "List of countries:
"
view1
echo ""
printf "Select a country: "
read country
abc=$country
if [ -z "$abc" ]
then
echo ""
echo " Please insert the name of the country
"
ask1 #using of recursive function
fi
}
userselect() {
echo " "
ask1
echo " "
if [ $abc == "FRA" ]
then
ans=false
fi
if [ $ans == true ]
then
echo "You have entered Invalid Option"
userselect
fi
}
#This function displays the players and the player codes
view(){
echo "Player: || Code:
"
echo "Messi || MES
Kagawa || KAG
Coutinio || COU
LLoris || LOR
Reus || REU
"
}
#This function displays the players and code and asks to enter any three
bestplayers(){
p=1
echo "List of players:
"
view
echo ""
printf "Select any three player : "
read players
if [ -z "$players" ]
then
echo ""
echo "Please insert the players.
"
bestplayers
else
check2 $players
fi
}
#It checks wheather the data are entered three times or not
check2(){
len=$(echo "$players" | wc -w)
echo ""
if [ $len -gt 3 ] || [ $len -lt 3 ]
then
echo "Only three players are allowed
"
bestplayers
else
loop $players
if [ $p -lt 4 ]
then
echo "Insert the validated data on the list.
"
bestplayers
else
ch $players
fi
fi
}
#It checks wheather the same data is entered or not
ch(){
str1=`echo $players | cut -d" " -f 1`
str2=`echo $players | cut -d" " -f 2`
str3=`echo $players | cut -d" " -f 3`
echo $str1 $str2 $str3
re(){
echo "Select a player :
"
j=1
for i in $players
do
echo $j "." $i
j=`expr $j + 1`
done
echo ""
read1
}
loop(){
for i in $players
do
for j in $array
do
if [ $i == $j ]
then
p=$((p + 1))
fi
done
done
#This function display the name and code of the players and asks to select
the best
read1(){
echo "Select the best player: "
select plays in $str1 $str2 $str3
do
case $plays in
"MES")
cat cw3/MES
echo ""
break
;;
"REU")
cat cw3/REU
echo ""
break
;;
"COU")
cat cw3/COU
echo ""
break
;;
"LOR" | "KAG")
echo "The file of this player is not found. Choose again"
;;
*)
echo "Choose again"
;;
esac
done
}
#It checks wheather the calue is chosen coreect or not
incorrect(){
ans=true
userselect $ans
if [ $ans == false ]
then
if [ $abc == "FRA" ]
then
echo "Correct country is chosen.
"
cat cw3/country
echo ""
bestplayers
else
echo "Wrong team entered. Try again"
incorrect
fi
fi
}
check(){
if [ $jkl == true ]
then
try 1
fi
if [ $var == $code ]
then
if [ $jkl == true ]
then
echo ""
hello $a $b
fi
incorrect
fi
}
#This function asks if the program wants to be repeated
main(){
until [ $mno == false ]
do
check
if [ $ghi == false ]
then
echo "Do you want to repeat the program again?"
read more
jkl=false
if [ $more != "yes" ]
then
echo "Thank you for using this program !!!"
break;
fi
else
break;
fi
done
}
main
Content of Files
• MES
Lionel Andrés Messi is an Argentine professional footballer who plays as a forward and
captains both Spanish club Barcelona and the Argentina national team.
Messi has won a record-tying five Ballon d'Or awards, four of which he won consecutively,
and a record five European Golden Shoes.
• COU
Philippe Coutinho Correia (born: 12 June 1992) is a Brazilian professional footballer who
plays as an attacking midfielder or winger for the Spanish club Barcelona and the Brazilian
national team.
In January 2018, Coutinho transferred to Barcelona in a record transaction fee reportedly
worth €142 million ($170 million), which would make him the world's third most
expensive player at that time.
• REU
Marco Reus (born 31 May 1989) is a German professional footballer who plays in the
forward position for the Germany national team and Borussia Dortmund.
He is the also the captain of Borussia Dortmund. With Dortmund, Reus won the DFL-
Supercup in 2013 and the DFB-Pokal in 2017, and has scored over 100 goals for the club.
With the Germany national team, Reus has only 37 caps, due to his recurring injuries in
recent years.
Testing:
A. Valid Testing
1. Test 1
Test 1
Input Input a valid parameter.
Expected result Parameter will be assigned and the program ask for the secret key.
Actual result Parameter was assigned and the program asked user to enter secret key.
Table 1: Test 1
2. Test 2
Test Id 2
Input Input Correct key.
Expected Output Program should move to next step
Actual Output Program moved to next step
Table 2: Test 2
3. Test 3
Test Id 3
4. Test 4
Test Id 4
Table 4 Test 4
5. Test 5
Test Id 5
Input a number of a chosen code from the list
Input
of players.
Expected Output Program will display the description of the
player that is selected by the user.
Table 5: Test 5
Figure 5 Test result after entering a number of a chosen code from the list of players.
6. Test 6
Test Id 6
Expected Output Program will repeat the loop and ask the user
to guess the best country team.
Table 6 Test 6
7. Test 7
Test Id 7
Table 7 :Test 7
8. Test 8
Test Id 8
9. Test 9
Test Id 9
Table 9 Test 9
Figure 9 Result for entering the wrong code name and selecting that option.
10. Test 10
Test Id 10
Figure 10 Result after entering the invalid secret key three times.
11. Test 11
Test Id 9
Table 11 Test 11
12. Test 12
Test Id 12
Table 12 Test 12
13. Test 13
Test Id 13
Input invalid country code.
Input
Table 13 Test 13
14. Test 14
Test 14
Input Input invalid player code.
Expected result Program will inform about the invalid player code ask user to enter the
player code until the correct code are entered.
Actual result Program was informed about the invalid player code and it asked user to
enter the player code until the correct code are entered.
Table 14: Test 14
15. Test 15
Test 15
Input Input same player code more than one time.
Expected result Program will inform about the invalid player code ask user to enter the
player code until the correct code are entered.
Actual result Program was informed about the invalid player code and it asked user to
enter the player code until the correct code are entered.
Table 15 Test 15
16. Test 16
Test 16
Input Input player code more than three time.
Expected result Program will inform about the invalid player code ask user to enter the
player code until the correct code are entered.
Actual result Program was informed about the invalid player code and it asked user to
enter the player code until the correct code are entered.
Table 16: Test 16
Figure 17: Result after entering player code more than 3 times
Conclusion
The task A of this coursework required to make a script using the UNIX shell. Every one of the
requirements of the coursework were satisfied and a script program was created. During the
development process I researched and learnt about a lot of UNIX commands and the bash syntaxes
to create an interactive program. I learnt about if, while, select, read, case, until commands and
also learnt to make good use of the echo and cat utilities. I have also learned to appropriately check
user input errors and diagnosed those errors with clear messages. For the test of the script, black
box testing process was led which helped me discover the errors and check whether the program
is working efficiently or not. Overall task A of this coursework has assisted me to improve my
programming skills in bash shell and complete legitimate testing of the script.
Task B
Introduction
The operating system that manages network resources including special function for connecting
computers and devices into a local area network is known as network operating system. The
network operating system manages multiple request concurrently and provides the security
necessary in a multiuser environment. It can be completely self-contained operating system. Some
of the example are NetWare, UNIX, Windows 2000, or Mac OS X. (University, 2019)
UNIX was developed by Bell Labs under AT and T. It is a powerful server operating system that
can also be used in peer-to-peer or client/server networks. Ii is written in C language. AT and T
released UNIX upon its completion in 1974 to universities. IT was enabled for people to go in and
actually view the source code of the system. It enabled coders to build the basic functions od the
original UNIX operating system. (Notes, 2019)
Aims
Objectives
Body of Report
I/O Structure
I/O units in UNIX has two main groups, block devices and character devices. Additionally, there
are sockets that are utilized for network communication.
Block Devices
• Block devices are usually called via the file system, but are also available as special files
• The devices that addresses blocks of a fixed size, usually disk memories.
• The data blocks are buffered in the buffer cache.
For example, Hard disks, USB cameras, USB pen drive, Disk-On-Key, etc.
Character Devices
• Terminals and printers, yet additionally everything else that don't utilize the block buffer
cache.
• A hardware device is recognized by its sort and a device number.
• Terminals and printers, yet additionally everything else that don't utilize the block buffer
cache.
• Device drivers are called by means of a switch table.
• It has one switch table for block devices and one for character devices.
For example, serial ports, sounds cards, parallel ports, etc.
It represents the structuring techniques and interfaces for the operating system which enables I/O
devices to be treated in a standard, uniform way. The differences are summarized in kernel
modules known as device drivers that are internally custom-tailored to each device but that export
one of the standard interfaces to applications. The motive of the device driver layer is to hide the
variances among device controllers from the I/O subsystem of the kernel. (padakuu.com, 2017)
The characteristics of I/O interfaces with respected to devices are listed below:
Kernel I/O Subsystem is in control to provide many services related to I/O. Some of the services
provided are listed below:
Scheduling − Kernel lists a set of I/O requests to control a good order in which to execute them.
At the point when the application issues a blocking I/O system call, the request is placed on the
queue for that device. The Kernel I/O scheduler modifies the order of the queue to improve the
overall system efficiency and the normal reaction time experienced by the applications.
Buffering − Kernel I/O Subsystem keeps up a memory area called buffer that stores data while
they are exchanged between two devices or between a device with an application operation.
Buffering is done to cope with speed disparity among the producer and consumer of a data stream
or to adjust between the devices that have dissimilar data transfer sizes.
Caching − Kernel maintains cache memory which is area of fast memory that holds the duplicates
of the data. Access to the cached copy is more is esdew3ffective than access to the first.
Spooling and Device Reservation − Spool is a buffer that holds output for a device, for example,
a printer, that cannot acknowledge interleaved data streams. Spooling system duplicates the
queued spool files to the printer each one in turn.
Error Handling − I/O requests can fall flat for many reasons, either transient or permanent I/O
requests normally return an error bit indicating the problem. Some devices are equipped for giving
significantly more detailed information about errors, and even keep an error log that can be
mentioned by the host.I/O Traffic Controller
It monitors the status of every device, control unit, and channel. Its three main tasks are:
2. In the event that more than one way, figure out which to choose.
3. If paths are all busy, decide when one will wind up accessible.
As the number of units in the I/O subsystem rises and as the number of paths between these units
increases its job becomes more compound. It maintains a database which contains the status and
connections for each unit in the I/O subsystem, gathered into Channel Control Blocks, Control
Unit Control Blocks, and Device Control Blocks.
It follows in reverse from the controller block of the requested device through the control units to
the channels to select a free path. When no path is available the process is connected to the queues
kept in the control blocks and this consequences in creating multiple wait queues with one queue
per path.
I/O Scheduler
It implements the policies that decides the allocation of devices, control units, and channels and
must choose which requests to satisfy first. When the number of requests is larger than the number
of available paths, the I/O scheduler must decide which request to satisfy first. I/O requests are not
preempted i.e. once the channel program has begun, its’s allowed to continue to conclusion even
though I/O requests with higher priorities may have entered the queue.
Some systems let the I/O scheduler to provide preferential treatment to I/O requests from high
priority programs. In that case, if a process has high priority, then its I/O requests would also have
high priority and would be pleased before other I/O requests with less priorities. The I/O scheduler
must synchronize its work with the traffic controller to make sure that a path is available to fulfill
the chosen I/O requests.
It processes I/O interruptions, handles error conditions and gives detailed scheduling algorithms.
UNIX system sets a global variable so distinct values can indicate the specific error that has
occurred.
A seek strategy for I/O device handler is the prearranged policy that the device handler uses to
allocate access to the device among the many processes that may be waiting for it. Most common
seek strategies are:
a) FCFS
It is the easiest device-scheduling algorithm and jobs are executed in first come, first serve
basis. It is simple to know and implement and implementation is based on FIFO queue.
b) SSTF
It is scheduling algorithm where shortest jobs are processed first and longer jobs are made
to wait.
c) SCAN
It is scheduling algorithm that uses a directional bit to specify whether the arm is moving
toward center of the disk or away.
DMA is a method of transferring data from RAM to another part of the computer without
processing it using CPU whereas most data that is input or output from PC is processed by CPU,
some data don’t require processing, or can be processed by another device.
DMA can save processing time and it is an effective way to transfer data from the computer’s
memory to other devices. For the devices to use DMA, they must be allotted to the DMA channel.
Each sort of port on a PC has a set of DMA channels that can be allotted to each connected device.
The DMA controller is combined into the processor board and manages all DMA data transfers.
Transferring data needs two steps. Data is transferred from sending device to DMA controller and
then to receiving device. Microprocessor gives DMA controller the destination, and amount of
data that is to be moved. Then DMA controller transfers the data, which lets the microprocessor
to continue with other processing tasks. (techterms, 2018)
Conclusion
This report is all about UNIX network operating system. The network operating system manages
network resources including special function for connecting computers and devices into a local
area network. UNIX was developed by Bell Labs under AT and T. It is a powerful server
operating system that can also be used in peer-to-peer or client/server networks. The main task of
the operating system is to handle input and output devices. I/O units in UNIX has two main groups,
block devices and character devices. And the I/O Application Interface represents the structuring
techniques and interfaces for the operating system which enables I/O devices to be treated in a
standard, uniform way.
References
Notes, C. N. (2019, April 15). Computer Network Notes. Retrieved from Computer Network
Notes: https://www.computernetworkingnotes.com/networking-tutorials/network-
operating-system-features-and-functions.html
padakuu.com. (2017, March 12). Application I/O Interface. Retrieved from padaku:
http://www.padakuu.com/article/128-application-io-interface
Stalling, W. (2005). The history of UNIX operating system. The UNIX operating system, IIII(2),
2.
University, I. (2019, April 15). Insiana University. Retrieved from Insiana University:
https://kb.iu.edu/d/ajlq
Appendix
The Unix operating system is a set of programs that act as a link between the computer and the
user. The computer programs that allocate the system resources and coordinate all the details of
the computer's internals is called the operating system or the kernel.
Users communicate with the kernel through a program known as the shell. The shell is a
command line interpreter; it translates commands entered by the user and converts them into a
language that is understood by the kernel.
Unix was originally developed in 1969 by a group of AT&T employees Ken Thompson, Dennis
Ritchie, Douglas McIlroy, and Joe Ossanna at Bell Labs.
There are various Unix variants available in the market. Solaris Unix, AIX, HP Unix and BSD
are a few examples. Linux is also a flavor of Unix which is freely available.
Several people can use a Unix computer at the same time; hence Unix is called a multiuser
system.
A user can also run multiple programs at the same time; hence Unix is a multitasking
environment.
Kernel − The kernel is the heart of the operating system. It interacts with the hardware and most
of the tasks like memory management, task scheduling and file management.
Shell − The shell is the utility that processes your requests. When you type in a command at
your terminal, the shell interprets the command and calls the program that you want. The shell
uses standard syntax for all commands. C Shell, Bourne Shell and Korn Shell are the most
famous shells which are available with most of the Unix variants.
Commands and Utilities − There are various commands and utilities which you can make use of
in your day to day activities. cp, mv, cat and grep, etc. are few examples of commands and
utilities. There are over 250 standard commands plus numerous others provided through 3rd
party software. All the commands come along with various options.
Files and Directories − All the data of Unix is organized into files. All files are then organized
into directories. These directories are further organized into a tree-like structure called the
filesystem TCP stands for transport control protocol. It is a connection oriented and reliable
protocol and is used for transfer of crucial data. On the other hand, UDP stands for User
Datagram Protocol. It is an unreliable and connection-less protocol which is used for services
that require fast transmission of data.
We are living in a world full of various types of networks. The most important network consists
of computers. We send e-mails to our friends, send them our pictures, listen to a distant radio
channel, and many more things. The whole functioning of the network seems to be running
seamlessly on a simple platform. However, behind this simple looking network, lies a complex
system that has been simplified by use of various protocols. Protocols define the rules,
conventions and data structures that govern the data communication.
These protocols are required because a computer network is a heterogeneous mixture of various
components. Computers that are interacting with each other may differ in various attributes like
hardware, software, specifications etc. Thus, a unifying set of rules is a must that should be
followed worldwide, in order to communicate the data between various types of computer
systems. We can simply say that it is a language that computers use to talk to each other.
• The goal for the block buffer cache is to reduce the number of read and write
operations to the disk memory
• If the same data are read several times within a short period of time, only one disk
access is needed.
• It often happens that written data are erased within a short period of time. For example
temporary files produced by a compiler. These data may never need to be written to
the disk if the cache uses long enough delay.
• However, using a long delay in writing imposes a risk. If the system crashes - all data
that is not written to disk is lost.
I/O Hardware
• point-to-point
• bus In a typical PC
• Use a busy-wait loop to wait for the device. Usually ok for writing to fast devices that
give short wait times.
Not good for reading because the waiting may be forever if no data arrives.