### Code 1 ```cpp #include #include #include using namespace std; struct Process { int processID; int burstTime; int priority; int waitingTime; int turnaroundTime; }; bool comparePriority(const Process &a, const Process &b) { return a.priority > numProcesses; vector processes(numProcesses); for (int i = 0; i > processes[i].burstTime; cout > processes[i].priority; } sort(processes.begin(), processes.end(), comparePriority); processes[0].waitingTime = 0; processes[0].turnaroundTime = processes[0].burstTime; for (int i = 1; i ### Code 2 ```cpp #include #include #include #include #include #include #include using namespace std; struct Message { long mtype; char mtext[100]; }; int main() { key_t key; int msgid; Message message; key = ftok("/tmp", '1'); if (key == -1) { perror("ftok"); exit(1); } msgid = msgget(key, 0666 | IPC_CREAT); if (msgid == -1) { perror("msgget"); exit(1); } message.mtype = 1; strcpy(message.mtext, "Hello, this is a message from the sender!"); if (msgsnd(msgid, &message, sizeof(message.mtext), 0) == -1) { perror("msgsnd"); exit(1); } cout ### Code 3 ```cpp #include #include #include #include #include #include #include using namespace std; struct Message { long mtype; char mtext[100]; }; int main() { key_t key; int msgid; Message message; key = ftok("/tmp", '1'); if (key == -1) { perror("ftok"); exit(1); } msgid = msgget(key, 0666 | IPC_CREAT); if (msgid == -1) { perror("msgget"); exit(1); } if (msgrcv(msgid, &message, sizeof(message.mtext), 1, 0) == -1) { perror("msgrcv"); exit(1); } cout ### Code 4 ```cpp #include #include int main() { int pipe_fd[2]; if (pipe(pipe_fd) == -1) { perror("Pipe creation failed"); return 1; } pid_t child_pid = fork(); if (child_pid == -1) { perror("Fork failed"); return 1; } if (child_pid > 0) { close(pipe_fd[0]); std::string message = "Hello from parent!"; if (write(pipe_fd[1], message.c_str(), message.length()) == -1) { perror("Write to pipe failed"); return 1; } close(pipe_fd[1]); } else { close(pipe_fd[1]); char buffer[50]; ssize_t bytes_read; bytes_read = read(pipe_fd[0], buffer, sizeof(buffer)); if (bytes_read == -1) { perror("Read from pipe failed"); return 1; } buffer[bytes_read] = '\0'; std::cout ### Code 5 ```cpp #include #include #include #include #include const int PORT = 8080; void handle_request(int client_socket) { const char* response = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n My C++ Web Server Hello, this is my first C++ web server! "; send(client_socket, response, strlen(response), 0); close(client_socket); } int main() { int server_socket = socket(AF_INET, SOCK_STREAM, 0); if (server_socket == -1) { std::cerr