0% found this document useful (0 votes)
5 views

Program 1,2

OS LAB FILE

Uploaded by

devilsgreat7
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 views

Program 1,2

OS LAB FILE

Uploaded by

devilsgreat7
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/ 6

Program :1

Study of hardware and software requirements of different


operating systems UNIX,LINUX,WINDOWS XP, WINDOWS7/8

1. UNIX
Hardware Requirements (varies by version)
• Processor: Typically supports RISC or x86 architectures (depends on the
vendor, e.g., Solaris, AIX)
• RAM: Minimum 64 MB (depends on version)
• Disk Space: 500 MB to several GB
• Other: Network interface card (NIC) for multi-user environments
Software Requirements
• Requires a bootloader (e.g., GRUB or LILO)
• Filesystem support (UFS, ext, etc.)
• Typically CLI-based; GUIs (like CDE) optional
• Development tools like C compiler, shell scripts, and UNIX libraries

2. LINUX
Hardware Requirements (varies by distro)
Lightweight Distros (e.g., Lubuntu, Puppy Linux):
• Processor: Pentium II or higher
• RAM: 128–512 MB
• Disk Space: 2–4 GB
Mainstream Distros (e.g., Ubuntu, Fedora):
• Processor: 1 GHz or faster
• RAM: 1–2 GB minimum
• Disk Space: 10–25 GB
Software Requirements
• GRUB or other bootloader
• File system support (ext4, xfs, btrfs, etc.)
• GUI options: GNOME, KDE, XFCE, etc.
• Package manager (e.g., APT, YUM)
• Bash shell and various scripting tools

3. Windows XP
Hardware Requirements
• Processor: 233 MHz or higher (300 MHz recommended)
• RAM: 64 MB minimum (128 MB recommended)
• Disk Space: 1.5 GB of available space
• Graphics: Super VGA (800 x 600) or higher resolution video adapter and
monitor
Software Requirements
• NTFS or FAT32 file system
• Internet Explorer 6 or later
• DirectX 9 for multimedia
• Drivers for peripherals (printer, network, etc.)

4. Windows 7
Hardware Requirements
• Processor: 1 GHz (32-bit or 64-bit)
• RAM:
o 1 GB (32-bit)
o 2 GB (64-bit)
• Disk Space:
o 16 GB (32-bit)
o 20 GB (64-bit)
• Graphics: DirectX 9 with WDDM 1.0 driver
Software Requirements
• NTFS file system
• .NET Framework for many apps
• Windows Installer 4.5
• Internet Explorer 8+

5. Windows 8
Hardware Requirements
• Processor: 1 GHz with PAE, NX, and SSE2 support
• RAM:
o 1 GB (32-bit)
o 2 GB (64-bit)
• Disk Space:
o 16 GB (32-bit)
o 20 GB (64-bit)
• Graphics: DirectX 9 with WDDM driver
Software Requirements
• UEFI firmware with Secure Boot (optional)
• .NET Framework 3.5/4.5
• Microsoft Account (for full feature access)
• Internet Explorer 10+
Summary Table
OS Min. RAM Min. Disk CPU Requirement Special Software Needs
UNIX 64 MB 500 MB+ RISC/x86 CLI tools, filesystem support
LINUX 128 MB–2 GB 2–25 GB Pentium II+ to 1 GHz+ GUI, bash, package manager
Windows XP 64 MB 1.5 GB 233 MHz FAT/NTFS, DirectX
Windows 7 1–2 GB 16–20 GB 1 GHz .NET, DirectX 9
Windows 8 1–2 GB 16–20 GB 1 GHz with PAE/NX UEFI (optional), DirectX 9
Program:2
Execute various UNIX system calls for
i. Process management
ii. ii. File management
iii. iii. Input/output Systems calls

1 Process Management – System Calls -


Process management uses certain system calls. They are explained below -
a. To create a new process – fork () is used.
b. To run a new program = exec () is used.
c. To make the process to wait = wait () is used. sleep()
d. To terminate the process – exit () is used.
e. To find the unique process id – getpid () is used.
f. To find the parent process id – getppid () is used.
g. To bias the currently running process property – nice () is used.

i. Example program for example of fork()


#include<stdio.h>
#include<unistd.h> ------> for fork() and sleep() functions
int main(){
int i, pid;
pid=fork();
if(pid==0){
for(i=0; i < 20; i++)
{
sleep(2);
printf(" from Child process %d\n", i);
}
}
else{
for(i=0; i < 20; i=i+2){
sleep(2);
printf(" from Parent process %d\n", i);
}
}

return 0;
}

ii. Example program for example of exec()


#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
int main(){
int i;
char *p[ ]={"./hello", NULL};
int pid;
pid=fork();
if(pid==0){
for(i=0; i < 10; i++){
sleep(2);
printf(" from Child process %d\n", i);
}
}
else{
for(i=0; i < 10; i=i+2){
sleep(2);
printf(" from parent process %d\n", i);
execv(p[0], p);
}
}
return 0;
}

2. File Management – System Calls -


There are four system calls for file management -
a. open (): System call is used to know the file descriptor of user-created
files. Since read and write use file descriptor as their 1st
parameter so to know the file descriptor open() system call is used.
b. read (): System call is used to read the content from the file. It can also
be used to read the input from the keyboard by specifying the 0 as file
descriptor.
c. write (): System call is used to write the content to the file.
d. close (): System call is used to close the opened file, it tells the
operating system that you are done with the file and close the file

#include<unistd.h> // for read and write functions for input from keyboard
#include<fcntl.h> // for open function and O_CREAT and O_RDWR flags
#include<stdio.h>
int main(){
int n,fd;
char buff[50];
printf("Enter text to write in the file:\n");
n= read(0, buff, 50);
fd=open("Amit",O_CREAT | O_RDWR, 0777);
write(fd, buff, n);
write(1, buff, n);
int close(int fd);
return 0;
}

3. Input/Output System Calls -


Basically, there are total 5 types of I/O system calls:
a. Create: Used to Create a new empty file.
b. open: Used to Open the file for reading, writing or both.
c. close: Tells the operating system you are done with a file descriptor
and Close the
file which pointed by fd.
d. read: From the file indicated by the file descriptor fd, the read()
function reads cnt bytes of input into the memory area indicated by buf.
A successful read() updates the access time for the file.
e. write: Writes cnt bytes from buf to the file or socket associated with
fd. cnt shouldnot be greater than INT_MAX (defined in the limits.h
header file). If cnt is zero,write() simply returns 0 without attempting any
other action

#include<unistd.h> // for read and write functions for input from keyboard
#include<stdio.h>
void main(){
char c;
int a=1, i;
while (a != 0) {
read(0, &a, 3);
i=a;
write(1, &i, 3);
write(1, "\n", 1);
}
}

You might also like