Output
#Experiment 3A
Child Process: Executing 'ls' command
a.out exp3A.c process.c
Parent Process: Child process complete
#Experiment 3B
Child process successfully created!
Child PID = 29921, Parent PID = 29920
a.out exp3B.c OSlab
Parent process successfully created!
Child PID = 29920, Parent PID = 17168
ENTER DIRECTORY NAME: OSlab
Contents of the directory 'OSlab':
exp3A.c
#Experiment 3C
Enter text to write:
fork() creates a child process.
fork() creates a child process.
#Experiment 4
gcc writer.c -oA
gcc reader.c -oB
./A
Enter a message to write into shared memory: shmat attaches the shared
memory segment to the process's address space.
Data written to shared memory: shmat attaches the shared memory segment to
the process's address space.
./B
Data read from shared memory: shmat attaches the shared memory segment to
the process's address space.
#Experiment 2A
User name: cristiano7 (Login name: cristiano7)
Current Shell: /bin/bash
Home Directory: /home/cristiano7
Your O/S Type:
Path:
/home/cristiano7/.local/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin
:/usr/local/games:/usr/games
Current directory: /home/cristiano7/Desktop/OSlab
Currently Logged: 0 user(s)
User name: cristiano7 (Login name: cristiano7)
Current Shell: /bin/bash
Home Directory: /home/cristiano7
Your O/S Type: linux-gnu
Path:
/home/cristiano7/.local/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin
:/usr/local/games:/usr/games
Current directory: /home/cristiano7/Desktop/OSlab
Currently Logged: 0 user(s)
#Experiment 2B
========================
System Configuration
========================
1. OS and Version, Release Number, Kernel Version:
--------------------------------------------------
OS Information: GNU/Linux
Kernel Name: Linux
Kernel Version: 6.11.2-amd64
Release Number: #1 SMP PREEMPT_DYNAMIC Kali 6.11.2-1kali1 (2024-10-15)
--------------------------------------------------
2. Available Shells:
---------------------
# /etc/shells: valid login shells
/bin/sh
/usr/bin/sh
/bin/bash
/usr/bin/bash
/bin/rbash
/usr/bin/rbash
/usr/bin/dash
/usr/bin/tmux
/bin/zsh
/usr/bin/zsh
---------------------
3. Mouse Settings:
-------------------
Pointer Control:
acceleration: 2/1 threshold: 4
-------------------
4. CPU Information:
--------------------
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 39 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 2
On-line CPU(s) list: 0,1
Vendor ID: GenuineIntel
Model name: Intel(R) Core(TM) i3-8130U CPU @ 2.20GHz
CPU family: 6
Model: 142
Thread(s) per core: 1
Core(s) per socket: 2
Socket(s): 1
Stepping: 10
BogoMIPS: 4416.00
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm
constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni
pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx
rdrand hypervisor lahf_lm abm 3dnowprefetch pti fsgsbase bmi1 avx2 bmi2
invpcid rdseed clflushopt arat md_clear flush_l1d arch_capabilities
Hypervisor vendor: KVM
Virtualization type: full
L1d cache: 64 KiB (2 instances)
L1i cache: 64 KiB (2 instances)
L2 cache: 512 KiB (2 instances)
L3 cache: 8 MiB (2 instances)
NUMA node(s): 1
NUMA node0 CPU(s): 0,1
Vulnerability Gather data sampling: Unknown: Dependent on hypervisor status
Vulnerability Itlb multihit: KVM: Mitigation: VMX unsupported
Vulnerability L1tf: Mitigation; PTE Inversion
Vulnerability Mds: Mitigation; Clear CPU buffers; SMT Host state
unknown
Vulnerability Meltdown: Mitigation; PTI
Vulnerability Mmio stale data: Mitigation; Clear CPU buffers; SMT Host state
unknown
Vulnerability Reg file data sampling: Not affected
Vulnerability Heartbleed: Vulnerable
Vulnerability Spec r stack overflow: Not affected
Vulnerability Spec store bypass: Vulnerable
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user
pointer sanitization
Vulnerability Spectre v2: Mitigation; Retpolines; STIBP disabled; RSB
filling; PBRS-eIBRS Not affected; BHI Retpoline
Vulnerability Srbds: Unknown: Dependent on hypervisor status
Vulnerability Tsx async abort: Not affected
--------------------
5. Memory Information:
-----------------------
total used free shared buff/cache available
Mem: 1.3Gi 617Mi 409Mi 18Mi 454Mi 708Mi
Swap: 1.3Gi 244Mi 1.1Gi
-----------------------
6. Hard Disk Information:
--------------------------
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 25G 0 disk
├─sda1 8:1 0 23.7G 0 part /
├─sda2 8:2 0 1K 0 part
└─sda5 8:5 0 1.3G 0 part [SWAP]
sr0 11:0 1 1024M 0 rom
--------------------------
7. File Systems Mounted:
-------------------------
Filesystem Size Used Avail Use% Mounted on
udev 602M 0 602M 0% /dev
tmpfs 133M 980K 132M 1% /run
/dev/sda1 24G 4.5G 18G 21% /
tmpfs 664M 4.0K 664M 1% /dev/shm
tmpfs 5.0M 8.0K 5.0M 1% /run/lock
tmpfs 1.0M 0 1.0M 0% /run/credentials/systemd-journald.service
tmpfs 664M 252K 663M 1% /tmp
tmpfs 1.0M 0 1.0M 0% /run/credentials/
[email protected]tmpfs 133M 1.5M 132M 2% /run/user/1000
-------------------------
System Configuration Display Complete!
#Experiment 2C
=========================
Scientific Calculator
=========================
1. Addition
2. Subtraction
3. Multiplication
4. Division
5. Exponentiation
6. Square Root
7. Trigonometric Functions
8. Exit
=========================
Enter your choice: 1
Enter first number: 2
Enter second number: 4
Result: 6
=========================
Scientific Calculator
=========================
1. Addition
2. Subtraction
3. Multiplication
4. Division
5. Exponentiation
6. Square Root
7. Trigonometric Functions
8. Exit
=========================
Enter your choice: 2
Enter first number: 4
Enter second number: 1
Result: 3
=========================
Scientific Calculator
=========================
1. Addition
2. Subtraction
3. Multiplication
4. Division
5. Exponentiation
6. Square Root
7. Trigonometric Functions
8. Exit
=========================
Enter your choice: 3
Enter first number: 2
Enter second number: 5
Result: 10
=========================
Scientific Calculator
=========================
1. Addition
2. Subtraction
3. Multiplication
4. Division
5. Exponentiation
6. Square Root
7. Trigonometric Functions
8. Exit
=========================
Enter your choice: 4
Enter dividend: 45
Enter divisor: 9
Result: 5.00000000000000000000
=========================
Scientific Calculator
=========================
1. Addition
2. Subtraction
3. Multiplication
4. Division
5. Exponentiation
6. Square Root
7. Trigonometric Functions
8. Exit
=========================
Enter your choice: 5
Enter base: 2
Enter exponent: 4
Result: 16
=========================
Scientific Calculator
=========================
1. Addition
2. Subtraction
3. Multiplication
4. Division
5. Exponentiation
6. Square Root
7. Trigonometric Functions
8. Exit
=========================
Enter your choice: 6
Enter number: 16
Result: 4.00000
=========================
Scientific Calculator
=========================
1. Addition
2. Subtraction
3. Multiplication
4. Division
5. Exponentiation
6. Square Root
7. Trigonometric Functions
8. Exit
=========================
Enter your choice: 7
Choose Trigonometric Function:
1. Sine
2. Cosine
3. Tangent
Enter your choice: 1
Enter the angle in degrees: 60
Sine(60°) = 0.866025
=========================
Scientific Calculator
=========================
1. Addition
2. Subtraction
3. Multiplication
4. Division
5. Exponentiation
6. Square Root
7. Trigonometric Functions
8. Exit
=========================
Enter your choice: 8
Exiting the calculator. Goodbye!