INTI International College PenangSchool of Engineering and Technology
3+0 Bachelor of Science (Hons) in Computer Science, in collaboration with Coventry University, UK
3+0 Bachelor of Science (Hons) in Computing, in collaboration with Coventry University, UK
Coursework cover sheet
Section A – To be completed by the student
Full Name:
NICHOLAS LEONG DI YONG
CU Student ID Number:
P19010872
Semester:1
Lecturer: VASUKY MOHANAN
Module Code and Title: 207SE OPERATING SYSTEMS, SECURITY AND NETWORK
Assignment No. / Title: Portfolio 1A 25% of Module Mark
Hand out date: 14/1/18
Due date: 3/2/19
Penalties: No late work will be accepted.
If you are unable to submit coursework on time due to extenuating circumstances you may be eligible for an extension. Please consult the lecturer.
Declaration: I/we the undersigned confirm that I/we have read and agree to abide by the University regulations on plagiarism and cheating and Faculty coursework policies and procedures. I/we confirm that this piece of work is my/our own. I/we consent to appropriate storage of our work for plagiarism checking.
Signature(s): ————————————–
Section B – To be completed by the module leader
Intended learning outcomes assessed by this work:
Make use of services provided by the operating system, such as process control, file management, threading, memory management, device access.
Understand mechanisms underlying the moderation system and be able to use the tools associated with them.
Marking scheme Max Mark
Report
100
Total
100 Lecturers Feedback
Internal Moderators Feedback
Lab Activity 1 LINUX Command Line (Commands and outcomes from a series of small tasks that require use of a number of Linux commands)
[1 mark each]ff
Type the following commands
Provide screenshots
Explain the purpose of the commands
pwd
It is a command line to show current location directory.
(i) ls lu
This command sorted out most recently folder by time and mostly used together with command ls.
(ii) ls X
This command sorted out folder based on their extension name.
(iii) ls -lt
This command sorted out folder accordingly by time.
Type the following in sequence:
(i) mkdir Games
This command allows user to create a new directory.
(ii) cd Games
This command locate users to the specific directory.
(iii) cd..
This command allows user to exit the previous directory.
Type the following in sequence:
cat >test1
Follow up the above command by typing Hello Everyone
This command create a file name test1 and allows user to enter their desire words. The text will be written into test1.
cat > test2
Follow up the above command by typing Bye Everyone
This command create a file name test2 and allows user to enter their desire words. The text will be written into test2.
cat test1 > test2
This command is to overwrite the existing content of test2 into test1 as the greater symbol goes from test1 to test2.
rm test1
Remove specific files or directory
mv test2 Games
Move files or directory from one place to another.
Use a text editor and type the following text (name the file as poem1)
My family’s fond of gadgetsand new technology.My mother likes her radio.My father likes TV.My sister likes to dance aroundthe house with headphones on.My brother plays on his PCuntil the break of dawn.The baby has a smartphoneand a touchscreen-tablet too.If we had pets, I’m surethat even they would have a few.We chat with instant messaging.We email and we text.We’re always looking forwardto the gadget we’ll get next.The power went out recently.That day was like no other.Our screens went blank and, strange but true,we talked to one another.
Type the command to concatenate poem1.txt to another pre-existing file
Merge 2 text files content into one.
Rename poem1.txt as poetry1.txt
Rename the file or directory.
Display the last 10 lines of poetry1.txt
Create a directory called tempstuff and move poetry1.txt from your working directory to tempstuff directory
Delete poetry1.txt
Lab Activity 2 OS and APIs
Answer the following questions:
Why do OS needs APIs. Illustrate your answer with a sample API used by Linux. [4 marks]
API is so important to operating system because it act as a template for developers. It also allows operating system and different software communicate with each others.
Differentiate the following: [2 marks each]
In kernel APIs
Application Programming Interface(API) of a piece of software is how someone is going to write a program interacting with it.
In kernel ABIs
Application Binary Interface (ABI) of a piece of software is how compiled program interacts with it. Next, it also decide data structures or computational routines are accessed in machine code.
Abstraction APIs
Abstraction API functionality to the library in a communication layer and data to a reloadable object thus allowing external tooling to make use of these without similarity, confusion and without them being tied directly to the resource.
Lab Activity 3 Bootloader
Differentiate GNU GRUB and LILO in terms of: [8 marks]
Features
GNU GRUB LILO
Has respective command line interface. LILO allows single command with argument.
Excellent technical support. Poor technical support
Fine documented. Tested and used widely.
Hard to configure Make configuration automatically
Purpose
GNU GRUB LILO
Can support limitless boot entries Users may choose which OS to boot
Able to load OS at different locations or networks. Users can configure settings during boot up. What is bochs? What is used for? [2 marks]
Bochs is an emulator software that vitualize a complete Intel x86 computer. It can run on a number of platforms example, x86, Sun, PPC, MIPS and Alpha.
Lab Activity 4 Outside the Processor [2 marks each]
Type the following commands. Explain the output.
ifconfig -a
Display the information of your systems network interface.
netstat -i
Display network interface for both transferring and receiving packets between the transaction.
nslookup google.com
This is a tool to perform DNS lookup. It will show the details such as IP address.
dhclient eth0
Allocate DNS dynamically
ifconfig eth0 – promisc
This command is to disable promiscuous mode, promisc is to switch the network interface into normal mode.
Lab Activity 5 OS Process Scheduling
Show the scheduling order for the following processes. All the processes arrive in numerical order at time 0. Show the scheduling order for:
[3 marks each]
FIFO
Shortest Job First
Round Robin (quantum = 1 time unit)
Lab Activity 6 Virtual Memory
Imagine that youve been asked to build an operating system for a simple
embedded processor. The processor has no virtual memory and no memory
translation unit. What functionality must you build into your process loader if you
wish to have multiple programs resident in memory? [4 marks]
To gain multiple program resident in memory, some kind of address relocation you need to take place to place the process onto a particular chunk of physical memory.
In a system with virtual memory, how can you share memory between two processes? [4 marks]
Memory between two processes can be share between segments or page table entities.
You have been asked to design an adaptive VM system. On a per-process basis, you must decide whether to swap the entire process in and out of memory or whether to simply demand-page it in. What statistics do you want to gather to help you make this decision? [3 marks]
The static I gathered is process image, working set size, rate of change of working set. The main advantage of accessing the process image is that the CPU includes a consistent image of the process signals for the period of one program cycle. If a signal state on an input module changes while the program is being executed, the signal state in the process image will be retained until the process image is updated again in the next cycle. The working set size usually used for capacity planning & scalability analysis.
Lab Activity 7 File Management [10 marks]
The Berkeley Fast Filesystem (and Linux Ext2fs) use the idea of block groups. Describe what this idea is and what improvements block groups have over the simple filesystem layout of the System V file system (s5fs).
Berkeley Fast Filesystem and ext2 creating block groups to extend the System V filesystem, everything were equally sized and replicating System V structure. Group descriptors, inode bitmap, data block bitmap and inode table was split into groups. This solution solves many problems with s5fs and the whole filesystem will no longer corrupt by the way of superblock.
What is the reference count field in the inode? You should consider its relationship to directory entries in you answer.
The reference count field may be a counter of what number times the inode is referenced by name. Adding a directory entry increments this counter. When the count falls to zero, its inode and every one corresponding disk blocks is safely deallocated.
Lab Activity 8 Kernel [2 marks each]
The following commands allows interaction with the Linux kernel. Explain the purpose of the commands. Provide screenshots of execution.
lsmod
It displays which kernel modules are currently running.
insmod module
Projectile a simple program into Linux Kernel.
modprobe module
Used to add a (LKM) loadable kernel module into Linux kernel or to remove one.
rmmod module
Remove a module from the directory.
Explain the following code:
# include < linux / module .h >
# include < linux / version .h >
# include < linux / kernel .h >
static int __init init_mod ( void ) /* Constructor */
{
printk ( KERN_INFO ” Module1 started … n “);
return 0;
}
static void __exit end_mod ( void ) /* Destructor */
{
printk ( KERN_INFO ” Module1 ended … n “);
}
module_init ( init_mod );
module_exit ( end_mod );
Lab Activity 9 Other Useful Linux Commands 2 marks each
Type the command that lists all the jobs currently running
Find all files with a filename that starts with p.
Compress multiple directories
Create an alias command for the command to create a directory
Write a shell script that prints current date and time and execute it
Lab Activity 10 Memory Management
The buddy system is a memory management scheme that uses variable sized partitions. Explain the basic principle behind the buddy system. [4 marks]
The buddy system uses binary numbers as memory allocation that run on the basis because these may help computer to manipulate faster.
If the partition size and process size were unequal then poor match take places and should use space in an inefficient way.
It will be more simple to implement than dynamic allocation.
Assume a computer with a memory size of 256K, initially empty. Requests are received for blocks of memory of 5K, 25K, 35K and 20K. Show how the buddy system would deal with each request, showing the memory layout at each stage and the status of the lists at the end. After allocating all the processes, what would be the effect of the 25K process terminating and returning its memory?
[6 marks]
The effect of the 25K process terminating and returning is 32K free list occupied by the memory (32K). The free memory next to its buddy should only add up to 56K as the memory cannot be merged at this point. In order to give 64K memory to its combine list, it would require the returning of the 8K process.