Os lab file
Os lab file
Solution:
When studying the hardware and software requirements for different operating systems, it's
important to look at the minimum and recommended specifications for each one. Below is a general
overview of the hardware and software requirements for four popular operating systems: UNIX, Linux,
Windows XP, and Windows 7/8.
Software Requirements:
System Libraries: Core libraries like libc (standard C library), X11 libraries for graphical interfaces,
etc.
Compilers: GCC (GNU Compiler Collection) or similar for compiling code.
Shell: Bash (Bourne Again Shell) or C Shell.
Utilities: A variety of tools for managing processes, files, and networking.
2. Linux Operating System
Linux is an open-source, Unix-like operating system kernel that supports a wide range of hardware
platforms. It comes in many distributions such as Ubuntu, Fedora, Debian, Red Hat, etc.
Software Requirements:
Kernel: A modern version of the Linux kernel (e.g., version 4.x or 5.x).
System Libraries: Standard libraries like glibc.
Shell: Bash or other shell alternatives.
Graphical User Interface (GUI): Optional, but X11, GNOME, or KDE for graphical environments
are common.
Package Manager: A package manager like apt (for Debian-based systems), yum (for Red Hat-based
systems), or zypper (for openSUSE).
Utilities: A full suite of command-line utilities like vi, curl, wget, etc.
3. Windows XP
Windows XP is an older operating system that was widely used from 2001 to the late 2000s. It has
been phased out and is no longer supported, but it is important for historical purposes.
Hardware Requirements:
Processor: 233 MHz or higher, ideally 500 MHz or more.
RAM: Minimum 64MB, recommended 128MB or more for smoother operation.
Disk Space: At least 1.5GB of free hard drive space.
Display: VGA or higher resolution, minimum of 800x600.
Other Requirements: Keyboard, mouse, CD-ROM drive (for installation).
Software Requirements:
System Libraries: Windows XP uses proprietary system libraries such as Kernel32.dll, User32.dll,
and GDI32.dll.
Windows Shell: Windows Explorer for GUI and command prompt for text-based operations.
Networking: TCP/IP stack for network support.
4. Windows 7/8
Windows 7 and 8 are much more modern operating systems with higher hardware requirements.
Windows 8 introduced a more touch-optimized interface and improvements in performance, while
Windows 7 was widely used for both home and enterprise environments.
Disk Space: At least 16GB for 32-bit OS or 20GB for 64-bit OS.
Display: 800x600 resolution or higher.
Other Requirements: DVD-ROM drive, DirectX 9 graphics device with WDDM 1.0 or higher driver.
Windows 7 (Recommended Requirements):
Processor: 2 GHz or faster.
Disk Space: At least 16GB for 32-bit OS, 20GB for 64-bit OS.
Graphics: DirectX 9 graphics device with WDDM driver.
Display: 1024x768 resolution or higher.
Other Requirements: DVD-ROM drive, internet connection for updates and activation.
Windows 8 (Recommended Requirements):
Processor: 2 GHz or faster.
RAM: 4GB or more.
Disk Space: 20GB or more.
Graphics: DirectX 10 compatible graphics card.
Software Requirements:
Solution:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/wait.h>
int main() {
int fd;
char buffer[100];
pid_t pid;
if (fd < 0) {
exit(1);
close(fd);
pid = fork();
if (pid < 0) {
perror("fork failed");
exit(1);
if (pid == 0) {
// Child Process
fd = open("example.txt", O_RDONLY);
if (fd < 0) {
exit(1);
close(fd);
// If execlp fails
perror("exec failed");
exit(1);
} else {
// Parent Process
return 0;
}
Output:
Solution:
#include<stdio.h>
struct process{
}p[100];
int main()
int i, n;
scanf("%d", &n);
printf("Enter Process ID, Arrival Time and Burst Time of process %d: ",i);
sort_by_arrival(p, n);
if(i==0) {
p[0].ct=p[0].at+p[0].bt;
else {
p[i].ct=p[i-1].ct+p[i].bt;
}
p[i].tat=p[i].ct-p[i].at;
p[i].wt=p[i].tat-p[i].bt;
//printf("\nProcess ID, Arrival Time and Burst Time of process %d: ",i);
display(p, n);
tat_sum=tat_sum+p[i].tat;
wt_sum=wt_sum+p[i].wt;
avg_tat=tat_sum/n;
avg_wt=wt_sum/n;
return 0;
temp = p[j];
p[j] = p[j+1];
p[j+1] = temp;
}
void display(struct process p[], int n)
int i;
printf("PID\tAT\tBT\tCT\tTAT\tWT");
Output:
PID AT BT CT TAT WT
1 0 5 5 5 0
2 1 4 9 8 4
3 2 2 11 9 7
4 3 1 12 9 8
Solution:
#include <stdio.h>
struct Process {
};
int main() {
scanf("%d", &n);
p[i].id = i + 1;
scanf("%d", &p[i].at);
scanf("%d", &p[i].bt);
p[i].done = 0;
while(completed < n) {
min_bt = p[i].bt;
idx = i;
if(idx != -1) {
time += p[idx].bt;
p[idx].ct = time;
p[idx].done = 1;
completed++;
} else {
// Output
printf("\nP\tAT\tBT\tCT\tTAT\tWT\n");
total_tat += p[i].tat;
total_wt += p[i].wt;
return 0;
}
Output:
P AT BT CT TAT WT
P1 0 5 5 5 0
P2 1 4 12 11 7
P3 2 2 8 6 4
P4 3 1 6 3 2