Operating Systems Programming Project
Operating Systems Programming Project Begin with the file skeletoncpu.c and create your server: a. Change CHAT_SERV_PORT to one of the ports assigned to you in the file netids_ports.pdf, that is attached to the assignment link in Blackboard. b. Add the read statement to get your server to listen for the data sent by the clients c. Add the code to compute the result for each instruction d.
If you can, please make your comments a different color so that I can quickly locate the code you added — (No points deduction if you cannot, but it would be appreciated since it will be the end of the semester and I will need to submit grades soon after and it would help me to get the grades finalized sooner) e. Develop a way to send a dummy instruction that indicates the last instruction from the last program has been executed from the server CPU to the client loader. f. Copy the skeleton.c file to a new inetcpuserver.
c file to serve as your project’s server
The two clients, inetloaderclient.c and inetprinterclient.c, they should work as is–simply: a. Change CHAT_SERV_PORT to the port you selected from the list in the file netids_ports.pdf, that is attached to the assignment link in Blackboard. The server, the loader client, and the printer client should all be talking on the same port. b. Comment the code including enough detail that I know you understand how they work c. Remove the print routine from the loader client that was inserted only for debugging.
Paste all of your code for the 3 files inetcpuserver.c
inetloaderclient.c, and inetprinterclient.c into a single Word or PDF document with the filename of the form ldunh2_csc389_Proj3.pdf with your NetID replacing mine in the filename. Do not send multiple files or zip files or you will receive a point deduction. You will not get credit for the assignment if I cannot open the file or if it is not readable.
Submit the file at the correct submission location
for Project 3 in the Assignments module of Blackboard before the due date, Monday, December 14, 2015 at 11:59 PM CST (UTC -6). The Expanded Directions In this assignment you will convert the program we have been working with to run using a clientserver model. There will be one server (inetcpuserver) and two clients (inetloaderclient and inetprinterclient). ** Important–Be sure to use one of the port numbers assigned to you in netids_ports.pdf – if you use the default you will be operating on the same port as other students and you and your classmates will be interfering with one another as you run your programs to test them. To set the port, simply change the value of the constant CHAT_SERV_PORT to one of the port numbers assigned to you in the netids_ports.pdf file.
Use the same value for all three (server, loader client, printer client). The code for the inetloaderclient.c and inetprinterclient.c is on uisacad in the directory ~ldunh2/csc389/clientserver/inetversions/inetloadercpuprinter I have put skeletoncpu.c in that directory too—it is a framework for developing the server piece. You will need to add the read statement to get it to read the data which the loader is sending over the socket. You will also need to add the code to compute the result for each instruction. You can copy your edited skeletoncpu.c code into a new inetcpuserver.c file that you create. The two client programs work as is.
You will need to change the port, comment the code, and take out some print statements that were put in them to debug the code. Client Loader — The client loader process will be executed after the server CPU process has been started and will connect over a socket to the server CPU process. The client loader process will load program instructions from a file called cpu.dat one at a time and send them over the (loadercpusocket) socket to the server CPU. After all programs have be sent to the server CPU, the loader client will execute a read statement that will cause it to block until the server CPU sends a message to the client loader that will indicate it is ok to exit. Server CPU – The server CPU will be executed first.
Operating Systems Programming Project
The server CPU process will setup two sockets — (loadercpusocket) and (cpuprintersocket) for the client loader and client printer to connect to the server CPU. The server CPU process will read instructions from the client loader from the (loadercpusocket) and execute them one at time and send the executed instruction over the (cpuprintersocket) to the printer process. Once the server CPU has received the last instruction of the last program from the client CPU, it will send a message to the client loader that it has received the last instruction and it is ok for the client loader to terminate.
After the server CPU has executed the last instruction for the last program and sent it to the client printer, it will execute a read statement that will cause it to block until the client printer sends a message to the server CPU that is ok to exit. You will have to develop a way to send a dummy instruction that indicates the last instruction from the last program has been executed from the server CPU to the client loader. Client Printer — The client printer process will connect over the (inetcpuprintersocket) socket to the server CPU process. It will read executed instructions one at a time that are being sent over the socket from the server CPU.
These instructions were executed by the CPU client. The printer will store each executed instruction for the current program in a local array. No program will contain more than 10 instructions. Therefore, the local array will hold a maximum of 10 instructions. Once all instructions for the current program have been received from the server CPU by the client printer, the printer process will print the executed program in the format below to a file named out.dat. The client printer will repeat this process until all programs have been printed. You will have to develop a way to send a dummy instruction that indicates the last instruction from the last program that was sent by the server CPU to the client printer, has been received. After the printer client has written the last executed instruction for the last program to the out.dat file the printer process may terminate.
The cpu.dat (input) file contains lines with an operator (+,-,*,/, or %) followed by two integer operands similar to the following: + 2 3 * 4 5 ? 0 0 Once your code is complete, you may compile it. There is an executable in your inetloadercpuprinter directory called gcccompile. If you execute the command ls on the inetloadercpuprinter directory one of the files listed should look like: -rwxr-xr-x 1 ldunh2 student users 48 Aug 29 20:53 gcccompile Make certain the permissions shown on this file begin with -rwx . If the “x” is not there you will not be able to execute the file.
If it says something like –rwyou will need to set the execute bit using the command: chmod 755 gcccompile There are other Unix commands that will get you there, but this is one of them. Once you know that the gccompile is executable (permissions begin begin with -rwx), use it to compile your three programs. The syntax will be gcccompile inetcpuserver gcccompile inetloaderclient gcccompile inetprinterclient DO NOT use the .c file extension or the compile will fail Once your programs are compiled, test them by opening three terminal sessions to uisacad and in each of them cd ~/csc389/clientserver/inetversions/inetloadercpuprinter In the first terminal session, run inetcpuserver.out; in the second terminal session, start inetloaderclient.out, then in the third session, start inetprinterclient.out If everything worked correctly the programs will exit normally and you will find a file in the directory called out.dat, with the program’s output in it. The out.dat (output) file will contain lines similar to the following: SOURCE + 2 3 * 4 5 OUTPUT 5 20 End. Order Now