Step-by-step instructions to compile and execute every practical assignment — for both Windows and Linux
add() method on a server over the network using Java RMI.
| File | Role |
|---|---|
| Adder.java | Remote interface – declares add(int, int) |
| AdderRemote.java | Server-side implementation of the remote interface |
| MyServer.java | Registers the stub with the RMI registry on port 5000 |
| MyClient.java | Looks up the stub and calls add(34, 4) remotely |
javac, java, rmiregistry)winget install Microsoft.OpenJDK.21sudo apt install default-jdkCompile all four source files from the folder containing them.
# Navigate to the assignments folder first javac Adder.java AdderRemote.java MyServer.java MyClient.java
Start the RMI Registry on port 5000 in a dedicated terminal. Keep it running.
rmiregistry 5000
Start the RMI Server in a second terminal. Keep it running.
java MyServer
Run the Client in a third terminal. You should see 38 printed (34 + 4).
java MyClient
Expected Output — Terminal 3 prints 38. If you see a Connection Refused error, make sure rmiregistry was started before MyServer, and both use port 5000.
+5*3-style strings and returns the computed result.
Critical – JDK 8 Only! CORBA (org.omg.*) was deprecated in Java 9 and completely removed in Java 11. You must use JDK 8 for this practical. Download from adoptium.net/releases and select "Java 8".
| File | Role |
|---|---|
| Calc.idl | Interface Definition Language – defines the calculate() and shutdown() operations |
| CalcServer.java | CORBA server — registers with the naming service and serves requests |
| CalcClient.java | CORBA client — looks up the server and performs calculations |
java -version must show 1.8)idlj – IDL-to-Java compiler (bundled in JDK 8)orbd – Object Request Broker Daemon (bundled in JDK 8)+53 → 5+3=8+ (43) - (45) * (42) / (47)0 to exit and shutdown serverGenerate Java stubs/skeletons from the IDL file.
idlj -fall Calc.idl # This creates a folder: WssCalculator/
Compile all Java files including the generated stubs.
javac -classpath . CalcServer.java CalcClient.java WssCalculator/*.java
Start the ORB Naming Daemon on port 1050 in Terminal 1. Keep it running.
orbd -ORBInitialPort 1050 -ORBInitialHost localhost
Start the CORBA server in Terminal 2. You should see "The SERVER is READY".
java CalcServer -ORBInitialPort 1050 -ORBInitialHost localhost
Run the client in Terminal 3, then enter calculations.
java CalcClient -ORBInitialPort 1050 -ORBInitialHost localhost # Input example: +53 → Output: 8 # Input example: *27 → Output: 14
| File | Description |
|---|---|
| Array.c | Rank 0 distributes chunks, each rank computes a local sum, rank 0 collects and prints the final sum (1+2+…+20 = 210) |
# Option A: WSL (Recommended for MPI on Windows) wsl --install # Then inside WSL run the Linux commands below # Option B: Native MS-MPI + MinGW # 1. Install msmpisetup.exe and msmpisdk.msi from Microsoft # 2. Install MinGW-w64 from winlibs.com # 3. Add both to PATH
sudo apt update sudo apt install -y openmpi-bin libopenmpi-dev gcc
sudo dnf install -y openmpi openmpi-devel gcc module load mpi/openmpi-x86_64
Compile using the MPI wrapper compiler.
mpicc -o array Array.c
gcc Array.c -o array -I "C:\Program Files (x86)\Microsoft SDKs\MPI\Include" ^ -L "C:\Program Files (x86)\Microsoft SDKs\MPI\Lib\x64" -lmsmpi
Run with exactly 4 processes (N=20, n=4 as per the code).
mpirun -np 4 ./array
mpiexec -n 4 array.exe
Expected Output — Each rank prints its local sum (ranks 0–3 each sum 5 numbers). Rank 0 prints final sum = 210.
POSIX Sockets – Linux / WSL Only. server.cpp and client.cpp use <sys/socket.h>, <unistd.h>, and other POSIX headers that do not exist on native Windows. Use WSL (recommended) or a Linux machine.
| File | Role |
|---|---|
| server.cpp | Master – accepts clients on port 8080, collects their clocks, computes average, sends offsets back |
| client.cpp | Slave – connects to port 8080, reports its random local clock, receives and applies correction |
sudo apt install g++ (Ubuntu)sudo dnf install gcc-c++ (Fedora)xcode-select --installg++ -o server server.cpp g++ -o client client.cpp
Start the server first in Terminal 1.
./server # Server prints its own random clock and listens on port 8080
Open one or more new terminals and run a client in each.
./client # Client prints its random clock and connects to 127.0.0.1:8080
Back in the server terminal, when asked "Do you have enough clients?" type 1 and press Enter. The server will compute the average and send offsets.
# You have connected 1 client(s) now. # Do you have enough clients? (input '1' for yes, '0' for no): 1
Expected Output — Each client prints "received local clock adjustment offset is add/minus X.XXXXXX" and then its adjusted clock. Server prints "Server new local clock is X" (should equal the average).
| File | Role | Port |
|---|---|---|
| MutualServer.java | Central server — accepts connections from both clients on port 7000, prints messages it receives | 7000 |
| ClientOne.java | Starts with the Token; connects to server (7000), listens on 7001 for token from ClientTwo | 7000, 7001 |
| ClientTwo.java | Receives token from ClientOne (7001) and passes it back in a loop | 7000, 7001 |
MutualServerClientOneClientTwoCompile all three Java files.
javac MutualServer.java ClientOne.java ClientTwo.java
Start the central server in Terminal 1.
java MutualServer # Prints: Server Started
Start ClientOne in Terminal 2. It immediately asks if you want to send data.
java ClientOne # Prints: Do you want to send some data? Enter Yes or No
Start ClientTwo in Terminal 3. It waits for the token from ClientOne.
java ClientTwo # Prints: Waiting for Token
Interact via Terminal 2 (ClientOne): type Yes to send data, then type your message. The data appears in the MutualServer terminal. The token then passes to ClientTwo automatically.
| File | Description |
|---|---|
| BullyAlgo.java | Self-contained simulation — enter number of processes, crash/recover them, and observe new coordinator election via menu |
1 — Crash a process2 — Recover a process3 — Display current coordinator4 — Exitjavac BullyAlgo.java java BullyAlgo
Follow the interactive prompts. Sample interaction:
Enter The Number Of Processes: 5 1. Crash A Process 2. Recover A Process ... 1 Enter A Process To Crash: 5 The Coordinator Has Crashed! Enter The Initiator: 3 *** New Coordinator Is 4 ***
Algorithm Logic: When the coordinator (highest-id process) is crashed, the initiator sends election messages to all higher-id processes. The highest remaining active process wins and becomes the new coordinator.
| File | Description |
|---|---|
| Ring.java | Simulation — user enters process IDs, one process initiates an election, the maximum ID in the ring becomes coordinator. Also contains helper class Rr. |
1 — Initiate election (enter the index of the initiating process)2 — Quitjavac Ring.java java Ring
Follow the interactive prompts. Sample interaction:
Enter the number of process: 4 Enter the id of process: 3 Enter the id of process: 7 Enter the id of process: 1 Enter the id of process: 5 Process 7 selected as coordinator 1.election 2.quit 1 Enter the process number who initialised election: 0 Process 7 selected as coordinator
Algorithm Logic: The initiating process sends its ID clockwise around the ring. Each active process appends its ID if it is active. The process with the maximum ID in the collected set becomes the new coordinator.
Add() and SayHello(), consumed by both a web page and a Windows console app.
| File | Role |
|---|---|
| FirstService.asmx | ASP.NET Web Service — provides Add(int a, int b) and SayHello() |
| WebApp.aspx | Web-based consumer — a browser form that calls both methods and shows results |
| WinApp.cs | Console consumer — calls both methods and prints output to terminal |
wsdl.exe and csc.exe (from .NET SDK)mono-complete packageEnable IIS: Control Panel → Programs → Turn Windows features on/off → tick Internet Information Services → OK.
Create folder C:\MyWebServices, copy FirstService.asmx and WebApp.aspx there.
In IIS Manager, add a new site pointing to C:\MyWebServices, port 80. Browse to:
http://localhost/MyWebServices/FirstService.asmx # Test service http://localhost/MyWebServices/WebApp.aspx # Consumer web page
Compile and run the console consumer (WinApp.cs) from Developer Command Prompt:
# Step 1: Generate proxy class from the running WSDL wsdl http://localhost/MyWebServices/FirstService.asmx?WSDL # Step 2: Compile proxy to DLL csc /t:library FirstService.cs # Step 3: Copy FirstService.dll to C:\MyWebServices\bin\ # Step 4: Compile the console app csc /r:FirstService.dll WinApp.cs # Step 5: Run it WinApp.exe
sudo apt install -y mono-complete mono-xsp4 # Copy .asmx files to a web directory, then: xsp4 --root /path/to/MyWebServices --port 8080 # Browse: http://localhost:8080/FirstService.asmx
Compile and run the console consumer with Mono:
wsdl http://localhost:8080/FirstService.asmx?WSDL mcs /t:library FirstService.cs mcs /r:FirstService.dll WinApp.cs mono WinApp.exe
Expected Output (WinApp.exe) — Calling Hello World Service: Hello World and Calling Add(2, 3) Service: 5.
| File | Role | Port |
|---|---|---|
| game_server.go | Go UDP server (game state broadcast) + TCP server (reliable events) | UDP:9000 / TCP:9001 |
| game_manager.go | Go HTTP server — REST endpoint to create game pods via kubectl | HTTP:8080 |
| GameClient.cs | Unity3D MonoBehaviour — UDP client that sends MOVE events and receives game state | UDP:9000 |
| deployment.yaml | Kubernetes Deployment + Ingress for the Game Manager (3 replicas) | — |
sudo apt install golang-gogo versionRun the game server (UDP:9000 + TCP:9001). Keep Terminal 1 open.
go run game_server.go # Game server UDP listening on :9000 # Game server TCP listening on :9001
Test the UDP endpoint with netcat (Linux/WSL) or PowerShell.
echo "MOVE:LEFT" | nc -u 127.0.0.1 9000 # Expect: STATE:map[127.0.0.1:xxxxx:[1 2]]
# Use netcat alternative or just run game_manager and check HTTP Test-NetConnection -ComputerName localhost -Port 9000
Run the game manager in Terminal 2 (requires kubectl installed & configured for the create-game endpoint to work).
go run game_manager.go # Game Manager listening on :8080
Test the REST endpoint to create a game:
curl -X POST http://localhost:8080/creategame \ -H "Content-Type: application/json" \ -d '{"player1":"alice","player2":"bob"}'
Invoke-RestMethod -Uri http://localhost:8080/creategame ` -Method POST -ContentType "application/json" ` -Body '{"player1":"alice","player2":"bob"}'
This is a Unity MonoBehaviour script. To run it:
GameClient.cs onto the GameObjectgame_server.go is running on port 9000MOVE:RIGHT every frameServer state: … outputBuild and push the Docker image, then deploy to Kubernetes.
# Step 1: Build Docker image for game manager docker build -t game-manager:latest . # Step 2: (If using Minikube) load image into Minikube minikube image load game-manager:latest # Step 3: Apply the Kubernetes manifest kubectl apply -f deployment.yaml # Step 4: Verify pods are running kubectl get pods kubectl get svc
Install Minikube (local Kubernetes) if you don't have a cluster:
winget install Kubernetes.minikube minikube start
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 sudo install minikube-linux-amd64 /usr/local/bin/minikube minikube start
| Practical | Language | Windows Tools | Linux Tools | Terminals |
|---|---|---|---|---|
| 01 – RMI | Java | JDK 8+ (any), winget: Microsoft.OpenJDK.21 |
sudo apt install default-jdk |
3 |
| 02 – CORBA | Java 8 ONLY | JDK 8 exactly from adoptium.net | JDK 8 exactly: apt install openjdk-8-jdk |
3 |
| 03 – MPI | C | MS-MPI SDK + Runtime + MinGW-w64 (or WSL) | sudo apt install openmpi-bin libopenmpi-dev gcc |
1 |
| 04 – Berkeley | C++ | WSL required (POSIX sockets) | sudo apt install g++ |
2+ |
| 05 – Token Mutex | Java | JDK 8+ | sudo apt install default-jdk |
3 |
| 06a – Bully | Java | JDK 8+ | sudo apt install default-jdk |
1 |
| 06b – Ring | Java | JDK 8+ | sudo apt install default-jdk |
1 |
| 07 – ASP.NET | C# / .NET | IIS + .NET Framework 4.x + .NET SDK (wsdl, csc) | Mono: sudo apt install mono-complete mono-xsp4 |
1–2 |
| 08 – Game (Go) | Go / C# / K8s | Go runtime (go.dev/dl), Docker Desktop, kubectl, Minikube, Unity Hub | sudo apt install golang-go + Docker + kubectl + Minikube + Unity Hub |
2+ |
wsl --install) for MPI and Berkeleysudo apt install default-jdk (Java 21 for most)sudo apt install openjdk-8-jdk (JDK 8 for CORBA)sudo apt install openmpi-bin libopenmpi-dev gcc g++sudo apt install golang-gosudo apt install mono-complete mono-xsp4Pro Tip – Managing Multiple JDK Versions on Windows
Use JABBA (jabba install 1.8 && jabba use 1.8) or simply keep two JDK folders and swap the JAVA_HOME environment variable before running each practical. For Linux use sudo update-alternatives --config java.
Port Summary: RMI uses 5000 • CORBA uses 1050 • Berkeley uses 8080 • Token Mutex uses 7000 & 7001 • Game Server uses UDP:9000 & TCP:9001 • Game Manager uses HTTP:8080. Ensure none of these ports are occupied by other processes before starting each practical.