Computer Systems: A Programmer's Perspective (3rd Edition)
3rd Edition
ISBN: 9780134092669
Author: Bryant, Randal E. Bryant, David R. O'Hallaron, David R., Randal E.; O'Hallaron, Bryant/O'hallaron
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Chapter 11, Problem 11.13HW
Program Plan Intro
IP addresses:
- The IP address denotes an unsigned integer that is 32-bit.
- The IP addresses is been stored by network programs in IP address structure.
- The addresses present in IP address structure are stored in network byte order.
- An unsigned 32-bit integer is transformed from host byte order to network byte order by “htonl” function.
- An unsigned 32-bit integer is transformed from network byte order host byte order by “ntohl” function.
- The IP address is presented to humans in a form known as “dotted-decimal” notation.
- Each byte is been represented by its corresponding decimal value and is separated by a period from other bytes.
Passing program arguments to server:
- The arguments for “GET” requests are passed in the URI.
- The character “?” separates filename from the arguments.
- The character “&” separates each argument.
- The arguments do not allow spaces in it.
Server passes arguments to child:
- The server calls “fork” to create a child process and calls “execve” to run program in child’s context once it receives a request.
- The child process sets CGI environment variable values.
- The “adder” program can reference it at run time using “getenv” function of linux.
Output is sent by child:
- The dynamic content of a CGI program is to be sent to standard output.
- A CGI program sends dynamic content to standard output.
- It uses “dup2” function for redirecting standard output to connected descriptor associated with client.
- The result written to standard output by CGI program, it goes directly to client.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Language : C / C++ / Python
Develop a simple Web server (parity generator) that is capable of processing the request from client. Create a socket connection, when contacted by the client the server has to process the request and give back the result.
Client part
The client has to send the data in bits (e.g 1100011000).
It also has to send the number of frames it has to separate the data (e.g. 2 frames)
Server part
Server has to split the data into 2 parts (Frame 1 -> 11000; Frame 2 ->11000) and send back to the client.
For each part server has to find the even parity and send
COM.
Write a device driver for a character device which implements a simple way of message passing. The kernel maintains a list of messages. To limit memory usage, we impose a limit of 4KB = 4*1024 bytes for each message and also impose a limit of the total number of messages stored in the kernel, which is 1000.
Your device driver should perform the following operations:
When the module is loaded, the device is created. An empty list of messages is created as well.
Removing the module deallocates all messages, removes the list of messages and removes the device.
Reading from the device returns one message, and removes this message from the kernel list. If the list of messages is empty, the reader returns -EAGAIN.
Writing to the device stores the message in kernel space and adds it to the list if the message is below the maximum size, and the limit of the number of all messages stored in the kernel wouldn't be surpassed with this message. If the message is too big, -EINVAL is returned,…
HOW TO DO THIS path FUNCTION IN C PROGRAMMING HELP!!!
Add a new built-in path command that allows users to show the currentpathname list, append one pathname, or remove one pathname. In your shellimplementation, you may keep a data structure to deal with the pathname list.If you do not use execle() or execve() that allows you to execute withyour own environment variables, you will need to add it to the “real” PATHenvironment variable for executables in the path to work correctly. The initialvalue of path within your shell shall be the pathname list contained in the PATHenvironment variable. Implement the path command as follows:• path (without arguments) displays the pathnames currently set. It shouldshow pathnames separated by colons. For example, "/bin:/user/bin".• path + ./bin appends the pathname to the path variable. You mayassume that only one pathname is added at a time.• path - ./bin removes the pathname to the path variable. You mayassume that only one pathname is removed at…
Chapter 11 Solutions
Computer Systems: A Programmer's Perspective (3rd Edition)
Ch. 11.3 - Prob. 11.1PPCh. 11.3 - Prob. 11.2PPCh. 11.3 - Practice Problem 11.3 (solution page 967) Write a...Ch. 11.4 - Prob. 11.4PPCh. 11.5 - Prob. 11.5PPCh. 11 - Prob. 11.6HWCh. 11 - Prob. 11.7HWCh. 11 - Prob. 11.8HWCh. 11 - Modify TINY SO that when it serves static content,...Ch. 11 - Prob. 11.10HW
Knowledge Booster
Similar questions
- Write a C program that scans all directories in a UNIX file system and finds and locates all i-nodes with a hard link count of two or more. For each such file, it lists together all file names that point to a file. Explain the key steps in your code and suggest one alternative approach.arrow_forwardHello. I need help developing a C or C++ program that simulate an 8-port Ethernet switch. The switch initially has no knowledge about the hosts connected to each port. It learns frame addresses and stores-and-forwards the frames. The input text file "in.txt" contains information of the incoming frames, one frame per line. There are 4 pieces of data per line: frame ID, arrival port, frame source address,and frame destination address. The frames arrive at the switch in the order of which they appearin the input file. Destination address "X" indicates a broadcast frame. Thank you! ********************PLEASE YOUR CODE MUST BE COMPLETE, COMPILE AND EXECUTE**************** The output text file "out.txt" has 8 lines. Each line lists all the frames departing from each port, here is an example: "in.txt" contains 5 incoming frames:F1 P2 B--AF2 P6 D--CF3 P5 E--BF4 P7 F--DF5 P6 D--X"out.txt" should list the departing frames on each port:P1: F1 F2 F5P2: F2 F3 F5P3: F1 F2 F5P4: F1 F2 F5P5: F1…arrow_forwardA TCP server requires four separate actions to start up: SOCKET, BIND, LISTEN, and ACCEPT. Argue either for or against the following proposi- tion: The TCP library should be redesigned to combine the four TCP server setup calls into just one or two new calls. If for, give the parameters and return values of the resultant new call(s), and give a description and example of its use. If against, give examples of things one might like to do that would be hindered by a consolidated system.arrow_forward
- Description: You are required to implement a server program that responds to both TCP and UDP requests from the corresponding clients. The service provided by the server is simply a substitute cipher/cryptosystem. The cipher replaces one character to another based on some key. The input message (plaintext) can be of any size but composed only of small-letter (abcdefghijklmnopqrstuvwxyz). The output (ciphertext) has the same size and composed also of small-letter characters. The key is limited to 7 characters (also small-letter). You need to treat each digit as a number according to its position in the alphabet. For example, a=0, b=1, …,z=26. To encrypt a message, you add a plaintext character with the corresponding key character (mod 26). The key might be repeated to match the length of the plaintext message. In the decryption, you subtract the corresponding key character from the ciphertext character (mod 26). Again the key might be repeated as necessary. For example, if the…arrow_forwardI need help starting my assignment. Write a program that optionally accepts an address and a port from the command line. If there is no address and port on the command line, it should create a TCP socket and print the address (i.e. server mode). If there is an address and port, it should connect to it (i.e. client mode). Once the connections are set up, each side should enter a loop of receive, print what it received, then send a message. The message should be “ping” from the client and “pong” from the server. In order to test this, you will need to run the same program twice. I had two command line windows open to run mine. Run first in server mode, then run in client mode using the information printed from the server as your command line arguments.arrow_forwardThe ReadableByteChannel instance allows us to read from the Buffers in Datagram Socket using its rea method. Select one: a. True b. False A ByteBuffer receives data from the channel and the read method returns the number of String read Select one: a. True b. Falsearrow_forward
- Do execution paths 3 and 4 encompass the first three conditions for a deadlock to occur?arrow_forwardFor each of the following isolation levels, give an example of a schedule that respects the specified level of isolation but is not serializable: a. Read uncommitted b. Read committed c. Repeatable readarrow_forwardSeparate the server code and client code into two different programs, server.py and client.py. Execute the server program first and then execute the client program. You should still get the same set of print messages as in the combined threaded code in proj.py In the program provided, the server just sends a message string to the client after it connects. In this step you have to modify the server in two cases.1) Modify the server code so that when the client sends a string to the server, the server reverses the string before sending it back to the client. For example, if the client sends HELLO to the server, the client should receive OLLEH. Your client program should print the string sent by the client and the corresponding string received by the client from the server.2) Modify the server code so that when the client sends a string to the server, the server change all letters to upper case letters and sending it back to the client. For example, if the client sends hello to the…arrow_forward
- n this assignment, you will develop a simple socket-based TCP program in C++ for a server that accepts lines of input from a client and prints the lines ontothe server’s standard output. Compile and execute your program. On any other machinethat contains a Web browser, set the proxy server in the browser to the host that isrunning your server program; also configure the port number appropriately.Your browser should now send its GET request messages to your server, and yourserver should display the messages on its standard output.Use this platform to determine whether your browser generates conditional GETmessages for objects that are locally cached Create an informal reportarrow_forward- Consider another carelessly written Web application, which uses a servlet that checks if there was an active session, but does not check if the user is authorized to access that page, instead depending on the fact that a link to the page is shown only to authorized users. What is the risk with this scheme? (There was a real instance where applicants to a college admissions site could, after logging into the Web site, exploit this loophole and view information they were not authorized to see; the unauthorized access was however detected, and those who accessed the information were punished by being denied admission.)arrow_forwardWrite in g++ Design and implement a simple, interactive shell program that prompts the user for a command, parses the command, and then executes it with a child process. In your solution you are required to use execv(), which means that you will have to read the PATH environment, then search each directory in the PATH for the command file name that appears on the command line.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education