0% found this document useful (0 votes)
5 views22 pages

Pook

The document is a laboratory manual for CSC222: Operating Systems at Qassim University, detailing various operating system concepts, types, and commands. It covers topics such as multi-threading, multi-tasking, and command line interfaces for MS-DOS and GNU/Linux. Exercises and methods for using command line commands are included for practical learning.

Uploaded by

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

Pook

The document is a laboratory manual for CSC222: Operating Systems at Qassim University, detailing various operating system concepts, types, and commands. It covers topics such as multi-threading, multi-tasking, and command line interfaces for MS-DOS and GNU/Linux. Exercises and methods for using command line commands are included for practical learning.

Uploaded by

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

Qassim University

College of Computer

CSC222: Operating Systems

Laboratory Manual
Laboratory Manual Operating Systems (CS222)
Lab Page 2

Lab #1: Introduction to Operating System in General

Objective:
To understand the operating system concepts such as multi-threading, multi-tasking,
multi-user’s, and GUI and with an example for each.

● Operating system
An operating system, or OS, is a software program that enables the computer
hardware to communicate and operate with the computer software. In other words, it
is a software that enables the interaction between hardware and software. Without a
computer operating system, a computer would be useless.

● Operating system types


As computers have progressed and developed so have the types of operating systems.
Below is a basic list of the different types of operating systems and a few examples of
operating systems that fall into each of the categories. Many computer operating
systems will fall into more than one of the below categories.

1. GUI - Short for Graphical User Interface, a GUI Operating System contains
graphics and icons and is commonly navigated by using a computer mouse or by
touch. Below are some examples of GUI Operating Systems:

1) macOS

2) Windows

College of Computer
Laboratory Manual Operating Systems (CS222)
Lab Page 3

3) GNU/Linux with a Desktop Environment or Window Manager

2. Single-user – One user can effectively do one thing at a time. Example: MS-DOS.

3. Multi-user - A multi-user operating system allows for multiple users to use the
same computer at the same time and/or different times. Below are some examples
of multi-user operating systems:

1) GNU/Linux
2) Unix
3) Windows

4. Multiprocessing - An operating system capable of supporting and utilizing more


than one computer processor. Below are some examples of multiprocessing
operating system:

4) GNU/Linux
5) Unix
6) Windows

5. Embedded System - An embedded system is a system that has software embedded


into computer-hardware. It may be an independent system or a part of large system.
Examples:

7) Real-time operating system (RTOS)


8) Embedded GNU/Linux

6. Real Time Operating System - a multitasking operating system that aims at


executing real-time applications. The main objective of real-time operating
systems is their quick and predictable response to events in it, the time interval

College of Computer
Laboratory Manual Operating Systems (CS222)
Lab Page 4

required to process and respond to inputs is so small that it controls the


environment. Examples:

1) QNX
2) RTLINUX

7. Multitasking - An operating system that is capable of allowing multiple software


processes to run at the same time. Below are some examples of multitasking
operating systems.

1) GNU/Linux

2) Unix
3) Windows

8. Multithreading - Operating systems that allow different parts of software program


to run concurrently. Operating systems that would fall into this category are:

1) GNU/Linux
2) Unix
3) Windows

Exercise:

1- Android and iOS are widely used operating systems. What categories of operating
systems do they fall in?
2- Describe three functions or services that are provided by operating systems.

College of Computer
Laboratory Manual Operating Systems (CS222)
Lab Page 5

--------------------------------------------------------------------------------------------------

HW: Do the exercise given and submit your work to the blackboard.

--------------------------------------------------------------------------------------------------

College of Computer
Laboratory Manual Operating Systems (CS222)
Lab Page 6

Lab #2
MS-DOS
(Windows Command Prompt)

Objective:

To understand MS-DOS OS and type some commands by using Command Line


Interface.

Method:
Work with MS-DOS OS and type some commands by using Command Line
Interface.

MS-DOS:

Short for Microsoft Disk operating system.

● MS-DOS is a non-graphical command line operating system


"http://www.computerhope.com/jargon/o/os.htm".
● MS-DOS is a single task operating system
"http://www.computerhope.com/jargon/o/os.htm".
● Created for IBM compatible computers that was first introduced by
Microsoft in August 1981 and was last updated in 1994 when MS-DOS
6.22 was released.
● Although the MS-DOS operating system is not commonly used today, the
command shell used through Microsoft Windows is.
● The commands are not case-sensitive
● Some command switches are case-sensitive

College of Computer
Laboratory Manual Operating Systems (CS222)
Lab Page 7

To open a Microsoft MS-DOS command prompt shell window, first click the
Windows Start menu (located at the very lower-left corner of your computer's
desktop) and select "Run...".

Then if you are using Windows XP or Vista or Windows 7, type cmd into the Run
box and click "OK". You could also type cmd.exe

List of cmd commands


(You must understand what each part of the output means)

Test the following commands using the command line interpreter


“cmd.exe”:
● ECHO Enable writing messages, writing text to file, and printing variables
D:\CS222>echo Hello, World!

Hello, World!

D:\CS222>echo Hello, World! > myfile.txt

D:\CS222>echo %PATH%

● DATE used to displays and sets system date:


C:\Windows\System32>date
The current date is: Sat 09/15/2018

● TIME used to displays and sets system time:


C:\Windows\System32>time

College of Computer
Laboratory Manual Operating Systems (CS222)
Lab Page 8

The current time is: 13:48:16.37

● VER used to display the version of Windows:


C:\Windows\System32>VER
Microsoft Windows [Version 6.1.7601]

● Format used to format hard disk drive:


C:\Windows\System32>format G:/q
Insert new disk for drive G:
and press ENTER when ready...
The type of the file system is RAW.
The new file system is FAT32.
QuickFormatting 15000M
Initializing the File Allocation Table (FAT)...
Volume label (11 characters, ENTER for none)?
Format complete.
14.6 GB total disk space.
14.6 GB are available.
8,192 bytes in each allocation unit.
1,917,951 allocation units available on disk.
32 bits in each FAT entry.
Volume Serial Number is 882B-BC05

● DIR used to display the contents (files or folders) of your directory


E:\OperatingSystem>dir
Volume in drive E is System
Volume Serial Number is 1691-3EF5
Directory of E:\OperatingSystem
09/15/2018 08:59 PM <DIR> .
09/15/2018 08:59 PM <DIR> ..
09/15/2018 08:59 PM 0 CS222LabManual.docx
1 File(s) 0 bytes
2 Dir(s) 4,497,408 bytes free

● CLS used to clear the screen

● CHKDSK used to scan through your entire hard drive to find and fix problems
C:\Windows\system32>chkdsk

College of Computer
Laboratory Manual Operating Systems (CS222)
Lab Page 9

The type of the file system is NTFS.


WARNING! F parameter not specified.
Running CHKDSK in read-only mode.
CHKDSK is verifying files (stage 1 of 3)...
620800 file records processed.
File verification completed.
669 large file records processed.
0 bad file records processed.
2 EA records processed.
61 reparse records processed.
CHKDSK is verifying indexes (stage 2 of 3)...
............................
............................
............................

● MKDIR or MD: used to create directory


● CHDIR or CD: used to change the current directory and move to another directory
● RMDIR or RD: used to remove/delete the directory
● TREE: used display the contents of the directory as three.

Examples:

1) MD d1
2) CD d1
3) CD ..
4) TREE
5) RD d1

COPY used to copy file or directory

o Copy in the same location with different name: copy file1.txt file2.txt
o Copy to another location with the same name: copy file1.txt dd
o Copy to another location with different name: copy file1.txt dd\f1.txt

ERASE or DEL used to delete file or directory

College of Computer
Laboratory Manual Operating Systems (CS222)
Lab Page 10

Example: del file1.txt

RENAME used to rename file


Example: ren file1.txt file2.txt

TYPE used to display the contents of the file on your screen


Example: type file1.txt

FIND used to report the location of a specific string of text characters in one or more
files.

1) Find “ABC” in the file1.txt and displays on the screen.


find “ABC” file1.txt

2) To display lines not having the text string on the screen.


find “ABC” file1.txt /v

3) To count and display the numbers of lines having the text string on the screen.
find “ABC” file1.txt /c

4) Ignore uppercase or lowercase during the search.


find “ABC” file1.txt /i

. means the current directory


.. means the parent directory

Ctrl + c sends sigint signal (terminates the running command)

Ctrl + Break sends sigbreak signal (cannot be ignored fully)

To print the command’s info and help append /h or /? after the name of the command

D:\CS222>comp /?
Compares the contents of two files or sets of files.

College of Computer
Laboratory Manual Operating Systems (CS222)
Lab Page 11

COMP [data1] [data2] [/D] [/A] [/L] [/N=number] [/C]


[/OFF[LINE]] [/M]

data1 Specifies location and name(s) of first file(s) to


compare.
data2 Specifies location and name(s) of second files to
compare.
/D Displays differences in decimal format.
/A Displays differences in ASCII characters.
/L Displays line numbers for differences.
/N=number Compares only the first specified number of lines in
each file.
/C Disregards case of ASCII letters when comparing
files.
/OFF[LINE] Do not skip files with offline attribute set.
/M Do not prompt for compare more files.

To compare sets of files, use wildcards in data1 and data2


parameters.

Exercise:
1. Create file using editor and write the following text in this file :

ABC

aBc

abc

Save the file as file1.txt and answer the following question:

a) What is the output of this command find “abc” /v file1.txt?

----------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------
b) What is the output of this command find “abc” /i /c file1.txt?

----------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------

College of Computer
Laboratory Manual Operating Systems (CS222)
Lab Page 12

c) What is the output of this command type file1.txt?

---------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------

d) If you want to delete file1.txt you must type ………………………………………….

2. What does the MORE command do? What is the difference between MORE and TYPE?

3. What is the difference between an absolute path and a relative path? Give an
example on each.

--------------------------------------------------------------------------------------------------

HW: Do the exercise given and submit your work to the blackboard.

--------------------------------------------------------------------------------------------------

College of Computer
Laboratory Manual Operating Systems (CS222)
Lab Page 13

Lab #3
GNU Bash
(Shell & General Commands)

Objectives:
To deal with a GNU/Linux Environment
To understand how to use bash
To understand how to type General Commands

Method:
Work with the bash shell and type some commands by using Command Line
Interface.

A GNU/Linux terminal provides access to all the native Linux commands as well as
command-line applications that often provide many more features than desktop
applications.

To achieve the lab task, make sure you have the two software tools below:

● VirtualBox.

● Pre-built VM image for Ubuntu.

College of Computer
Laboratory Manual Operating Systems (CS222)
Lab Page 14

To run VirtualBox with Ubuntu in it, follow the steps below:

● Launch VirtualBox and click the “New” toolbar icon to open the Create Virtual
Machine dialog.

● Enter a name for the VM image and select the appropriate Type and Version.

● Use the folder icon to browse and locate the Ubuntu 16.04 VDI image

College of Computer
Laboratory Manual Operating Systems (CS222)
Lab Page 15

● Now we can click “Start” in VirtualBox Manager window to start the Ubuntu VM.

● The VM window opens to display the Ubuntu logon screen:

College of Computer
Laboratory Manual Operating Systems (CS222)
Lab Page 16

Do not be confused that the “osboxes” user is prompted to you as “osboxes.org”.


The user name is “osboxes” and the password is “osboxes.org”.

On Android, you can Install Termux.

After installing Termux, issue the following commands:


$ pkg update

$ pkg install man

$ pkg install nano

$ pkg install file

$ pkg install clang

During the lab: You have VirtualBox installed and a Ubuntu image available in
D: drive.

College of Computer
Laboratory Manual Operating Systems (CS222)
Lab Page 17

To open the terminal, You can either:

● Open the Dash by clicking the Ubuntu icon in the upper-left, type "terminal", and
select the Terminal application from the results that appear.

● Hit the keyboard shortcut Ctrl-Alt+T.


● Commands are case-sensitive

Basic Commands

(You must understand what each part of the output means)

1. date: set or show system time and date

2. cal: shows a calendar

3. uptime: how long the system has been running

4. pwd: To know which directory you are in

College of Computer
Laboratory Manual Operating Systems (CS222)
Lab Page 18

5. ls: to know what files are in the directory you are in.

6. cd: to go to a directory. (cd alone without arguments moves you to your home
directory)

7. mkdir: to create a folder or a directory


rmdir: to delete a directory

8. touch: used to create a file

9. man, info, and help: to know more about a command and how to use it
example: ”man cd” shows the manual pages of the cd command

College of Computer
Laboratory Manual Operating Systems (CS222)
Lab Page 19

10. cp: to copy files through the command line

11. mv: to move files through the command line

12. locate (or find -name “name of file”: used to locate a file in a Linux
system, just like the search command in Windows

13. clear:
14. exit: quit

College of Computer
Laboratory Manual Operating Systems (CS222)
Lab Page 20

Intermediate Commands

15. echo: to move some data, usually text into a file.


1) > Overwrite
2) >> Append
cat: to view contain of file, create single or multiple files, and concatenate files and
redirect output in terminal or files..

16. file: print the file type

17. sudo and su: stands for "SuperUser Do". If you want any command to be done
with administrative or root privileges, you can use the sudo command

College of Computer
Laboratory Manual Operating Systems (CS222)
Lab Page 21

. Current directory

.. Parent directory

~ Home directory

. in the beginning of the name of a file or a directory means that it is


hidden.

Exercise:

Write the commands to accomplish the following:

● Show the processes/programs taking up the system resources.

● Stop one of these running processes.

● Shutdown the virtual machine.

● Show the output of head and tail on the same text file.

● Explain the difference between head and tail.

● Print the command history list.

● What are environment variables?

● How to print all environment variables?

● How to print the contents of a specific environment variable?

● Display the amount of used and free memory (RAM) in a human readable format.

The commands you need to achieve these tasks are not given in this manual. You are
expected to access external materials to accomplish your exercise.

--------------------------------------------------------------------------------------------------

College of Computer
Laboratory Manual Operating Systems (CS222)
Lab Page 22

HW: Do the exercise given and submit screenshots of your work to the
blackboard.

--------------------------------------------------------------------------------------------------

Lab #4
System Calls

College of Computer

You might also like