0% found this document useful (0 votes)
10 views9 pages

Viva Question

The document discusses critical systems, focusing on the critical section problem and two process solutions: Peterson's and Dekker's algorithms, which ensure synchronized access to shared resources. It also outlines the hardware and software requirements for running PHP, detailing necessary operating systems, web servers, and hardware specifications. Additionally, it differentiates between Mobile IP and traditional IP addressing, highlighting Mobile IP's ability to maintain ongoing connections while moving across networks.

Uploaded by

sahu76513
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views9 pages

Viva Question

The document discusses critical systems, focusing on the critical section problem and two process solutions: Peterson's and Dekker's algorithms, which ensure synchronized access to shared resources. It also outlines the hardware and software requirements for running PHP, detailing necessary operating systems, web servers, and hardware specifications. Additionally, it differentiates between Mobile IP and traditional IP addressing, highlighting Mobile IP's ability to maintain ongoing connections while moving across networks.

Uploaded by

sahu76513
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Question1: Define critical system.

Discuss the two process solutions of critical section


problem.

Definition of Critical System:

A critical system (also known as a critical section system or concurrent system) refers to a
system in which multiple processes or threads execute concurrently and share common
resources such as variables, files, printers, etc. When multiple processes access and modify
shared resources simultaneously, it may lead to data inconsistency, race conditions, or
unexpected behavior.

To ensure correct and synchronized access to these resources, the part of the program where the
shared resource is accessed is called the Critical Section.

Critical Section Problem:

The Critical Section Problem is the challenge of designing a protocol that allows multiple
processes to share a resource without conflict.

Each process has a segment of code called the critical section, in which it accesses the shared
variables or resources. The problem is to ensure that no two processes are executing their
critical sections at the same time.

Requirements for a Solution:

A valid solution to the critical section problem must satisfy three key conditions:

1. Mutual Exclusion: Only one process can enter the critical section at a time.
2. Progress: If no process is in the critical section, and some processes wish to enter, then
one of them must be allowed to enter without indefinite delay.
3. Bounded Waiting: There must be a limit on the number of times other processes are
allowed to enter their critical sections before a waiting process gets its turn.

Two-Process Solutions of Critical Section Problem:


Let's assume we have two processes: P0 and P1. Below are two classical software-based
solutions for two processes:
1. Peterson’s Algorithm:

Peterson’s algorithm is a classic software-based solution for the two-process critical section
problem. It uses two shared variables:

 flag[2]: Boolean array where flag[i] is true if process Pi wants to enter the critical
section.
 turn: An integer variable indicating which process's turn it is.

Algorithm (for process Pi):

c
CopyEdit
do {
flag[i] = true; // I want to enter the critical section
turn = j; // Let the other process go first
while (flag[j] && turn == j); // Wait if other process wants to enter and
it's its turn

// Critical Section

flag[i] = false; // Exit critical section

// Remainder Section

} while (true);

Explanation:

 A process sets its flag to true to indicate it wants to enter.


 It sets turn to the other process’s ID.
 It waits while the other process also wants to enter (flag[j] == true) and it’s that
process’s turn.
 When the loop exits, the process safely enters its critical section.
 After finishing, it sets its flag to false.

Peterson’s Algorithm satisfies all three requirements:

 Mutual Exclusion
 Progress
 Bounded Waiting

2. Dekker’s Algorithm:

Dekker’s Algorithm is the earliest known software-based solution to the critical section problem.
It uses the following shared variables:
 flag[2]: Indicates interest of process in entering the critical section.
 turn: Indicates whose turn it is.

Algorithm (for process Pi):

c
CopyEdit
do {
flag[i] = true;
while (flag[j]) {
if (turn == j) {
flag[i] = false;
while (turn == j); // Wait
flag[i] = true;
}
}

// Critical Section

turn = j;
flag[i] = false;

// Remainder Section

} while (true);

Explanation:

 A process sets flag[i] = true to declare interest.


 If the other process is also interested (flag[j] == true), it checks whose turn it is.
 If it is the other process's turn, it resets its own flag and waits.
 Once allowed, it enters the critical section and then gives the turn to the other process.

Dekker’s Algorithm also satisfies:

 Mutual Exclusion
 Progress
 Bounded Waiting

But it is more complex and less efficient than Peterson’s Algorithm.

Conclusion:

Both Peterson's and Dekker's algorithms provide correct two-process solutions to the critical
section problem in a shared-memory environment without using hardware support like
semaphores or mutexes.

 Peterson’s Algorithm is preferred due to its simplicity and better clarity.


 These algorithms are important from a theoretical point of view and form the foundation
for modern synchronization mechanisms.

Question2: What are the hardware and software requirements for running PHP?

To run PHP (Hypertext Preprocessor), which is a popular server-side scripting language,


certain hardware and software requirements must be met. These requirements depend on the
environment where PHP is to be deployed: whether on a local development machine, a shared
server, or a production server.

✅ Software Requirements for Running PHP


1. Operating System (OS):

PHP can run on most operating systems, including:

 Windows (Windows 7, 8, 10, 11, Server 2016/2019/2022)


 Linux (Ubuntu, CentOS, Debian, Fedora, Red Hat, etc.)
 macOS
 UNIX variants (FreeBSD, Solaris)

Note: Linux-based servers are most commonly used in production environments due to better
performance and stability for web hosting.

2. Web Server:

To run PHP scripts, you need a web server that can interpret and serve PHP files.

 Apache HTTP Server (Most widely used with PHP)


 Nginx (Lightweight and high-performance alternative)
 LiteSpeed (Efficient and optimized for PHP hosting)
 Microsoft IIS (For Windows servers)

PHP is commonly run using Apache + PHP + MySQL, also known as the LAMP stack (Linux,
Apache, MySQL, PHP).

3. PHP Engine / Interpreter:


You need to install the PHP runtime itself.

 Latest PHP version (recommended) – as of mid-2025, this might be PHP 8.3 or newer
 PHP modules/extensions depending on the functionality needed (e.g., mysqli, curl, gd,
json, mbstring, etc.)

Use command:

bash
CopyEdit
php -v

To check if PHP is installed and see its version.

4. Database System (Optional but Common):

If your PHP application needs to interact with a database:

 MySQL or MariaDB (most common)


 PostgreSQL
 SQLite
 MongoDB (NoSQL, supported with extensions)
 Others: Oracle, SQL Server, etc.

5. Development Tools (Optional but Useful):

 IDE/Editor: VS Code, PHPStorm, Sublime Text, Notepad++, etc.


 Composer: Dependency Manager for PHP
 XAMPP/WAMP/LAMP/MAMP: Preconfigured packages for local development that
include Apache, PHP, and MySQL

✅ Hardware Requirements for Running PHP


The hardware requirements depend on the type of application and expected
traffic.

1. Minimum Requirements for Local Development:

 CPU: Dual-core processor (Intel i3 or AMD equivalent)


 RAM: 4 GB
 Storage: 1–2 GB free for PHP, server, and tools
 Network: Localhost or LAN access

Ideal for learning or developing small-scale PHP projects.

2. Recommended Requirements for Medium Applications / Shared Hosting:

 CPU: Quad-core processor or better


 RAM: 8 GB or more
 Storage: SSD with at least 10–20 GB free
 Bandwidth: Good internet connection for serving clients

3. Production Server Requirements (Hosting Live PHP Applications):

These vary depending on the scale of the website or application:

Use Case CPU RAM Storage Notes


(SSD)
Small website 1 vCPU 1–2 GB 10 GB Shared/VPS hosting
Medium 2–4 4–8 GB 20–40 GB VPS or Cloud hosting
site/blog vCPUs
High-traffic 4–8 8–16 50+ GB Dedicated or scalable cloud server
site vCPUs GB (AWS, Azure)

Note: Use SSDs for faster access, especially for database-heavy applications.

✅ Optional (but Recommended) Enhancements:


 PHP-FPM (FastCGI Process Manager) for faster PHP execution
 Caching tools like OPcache, Memcached, or Redis
 SSL certificate (HTTPS support)
 Monitoring tools (New Relic, Prometheus)

✅ Summary Table
Component Requirement
OS Windows, Linux, macOS, UNIX
Web Server Apache, Nginx, LiteSpeed, IIS
PHP Interpreter PHP 7.4+, PHP 8.0+, with required extensions
Database MySQL, MariaDB, PostgreSQL, SQLite
(optional)
CPU Dual-core or better (based on load)
RAM 4 GB minimum (8+ GB recommended for production)
Disk SSD preferred, 10+ GB free space
Tools IDE, Composer, XAMPP/WAMP, terminal access

Question3: Differentiate between mobile IP and traditional IP addressing.

The difference between Mobile IP and Traditional IP Addressing lies primarily in their ability
to support mobility of devices across networks without losing ongoing connections or needing to
change IP addresses.

Here's a detailed comparison:

🔹 1. What is Traditional IP Addressing?


🔸 Definition:

Traditional IP addressing (IPv4 or IPv6) assigns an IP address to a device based on its current
location in the network. The IP address typically corresponds to the network (or subnet) to
which the device is connected.

🔸 Key Characteristics:

 IP address changes when the device moves to a different network.


 IP address indicates both host identity and location.
 No built-in support for mobility.

🔸 Example:

 A laptop connected to a Wi-Fi network at home might get 192.168.1.10.


 If the same laptop connects to a university network, it might get 10.0.5.8.
 All ongoing connections are terminated when IP address changes.

🔹 2. What is Mobile IP?


🔸 Definition:

Mobile IP is a protocol developed by the IETF (RFC 5944 for IPv4, RFC 6275 for IPv6) that
allows a mobile device to move across networks while maintaining a permanent IP address
and ongoing connections.

🔸 Key Components:

 Home Address: Permanent IP address of the mobile device (like a phone number).
 Care-of Address (CoA): Temporary IP address based on the current foreign network.
 Home Agent (HA): A router on the home network that forwards packets to the mobile
device.
 Foreign Agent (FA): A router on the visited network that helps deliver packets to the
mobile device (optional in newer versions).

🔸 How It Works:

1. The mobile device moves to a new network and gets a care-of address.
2. It registers the care-of address with its home agent.
3. The home agent intercepts any packets sent to the home address and tunnels them to the
care-of address.
4. The mobile device receives data seamlessly without changing its IP (from the perspective
of the sender).

🔸 Comparison Table: Mobile IP vs Traditional IP


Addressing
Feature Traditional IP Mobile IP
Addressing
Mobility Support ❌ No ✅ Yes
IP Address Changes on ✅ Yes (IP changes) ❌ No (IP remains constant)
Move
Ongoing Connection ❌ Broken when device ✅ Maintained across networks
Stability moves
Routing Direct, based on current Via Home Agent (may cause triangular
IP routing)
Use of Agents ❌ Not required ✅ Requires Home Agent (and
optionally Foreign Agent)
Configuration Complexity Simple More complex (registration, tunneling,
agent configuration)
Tunneling/Encapsulation ❌ No ✅ Yes (IP-in-IP or GRE encapsulation
used)
Security Concerns Minimal Higher (needs authentication,
encryption)
Examples of Use Web browsing from Smartphones, laptops roaming across
fixed devices networks, IoT devices

🔹 Key Advantages of Mobile IP:


 Ensures seamless mobility for users.
 Maintains constant IP address, simplifying communication for services like VoIP, video
calls, and VPNs.
 Enhances user experience in wireless and cellular networks.

🔹 Limitations of Mobile IP:


 Triangular routing: Data from the sender goes to the home agent and then to the mobile
node, adding delay.
 Higher overhead due to tunneling and registration.
 Security vulnerabilities if not properly configured (e.g., spoofing, hijacking).
 More complex infrastructure setup required.

✅ Conclusion:
Topic Summary
Traditional Designed for static devices; doesn't handle mobility well.
IP
Mobile IP Designed to support seamless mobility across networks by decoupling the
device's identity (home IP) from its location (care-of address).

You might also like