Assesment 2
Assesment 2
Name:
Farhan Naseer
Registration No:
044
Subject:
Operating System
Submitted to:
Maam Saba Latif Date:
26-10-2024
1
Answer:
Here we run the simple code for system calls in c++ in dev and below is the output.
2
Output:
The output shows the directory and it also run the code which is used to sleeping process and awake
process.
And then it shows the current directory , creating and deleting file etc.
3
Q2: Brief with Screen Shot about Network and internet setting [5 marks] Answer:
4
This first gigure shows that there is no available internet connection.
And on the left side we the bar open which sows different option
Wifi
Ethernet
Dialup
Mobile hotspot etc
5
Then in this figure we have the available net connection which is through wifi connection and
below it also shows a bunch different other option like properties etc.
And then this windows shows the wifi connection, Ethernet (which wired connection) and also
Bluetooth connectivity.
6
Then this tab shows more wifi options.
7
And this tab again shows the Ethernet connection we didn’t have any connection at this time so it
shows nothing.
Q3: Attempt each and every Question with Clear Screen shot and also write short process
description in your own words: [Marks 35]
1: File Creation
Use C++ to write a program that creates a file named sample.txt, writes “; Hello World;” to
it, and then deletes the file.
2: Change File Permissions:
Write a PowerShell script that creates a text file and changes its permissions to make it
read-only.
3: Fork-like Behavior:
Simulate a parent-child process using PowerShell by launching Notepad from a parent
script and logging messages from both.
4: Invoke a System Call:
8
Use C++ to invoke a system call that retrieves system information (e.g., CPU architecture,
OS version) and prints it 5: Automate Backup:
Write a PowerShell script that creates a backup of a specific folder by copying it to another
location and logs the action.
Answer:
Creating hello world sample text file and then delete it.
9
Above code shows how the file is created through code.
10
In this powerShell code we 1rstly created and then changed the permission of the file to read only.
3: Fork-like Behavior:
11
And then by using powershell code we create a parent child process through notepad.
Then again we uses c++ to know the version and CPU architecture and prints it.
12
5: Automate Backup:
And in last we created a file first in one place and then we created its backup in other place so if we lost
that data we can have the backup of it in another place.
13