COMPUTER SYSTEMS&MOD MSGT/ET SA AC PKG
3rd Edition
ISBN: 9780134671123
Author: Bryant
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
Write a 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.
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&MOD MSGT/ET SA AC PKG
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_forwardModify the pthread-data-sharing-mutex-os-call.cpp program to apply a Pthread mutex solution, i.e., you will use Linux system calls to control access to the critical region. Note: Mutex initialization can be done in two ways: Using a mutex initialization function (https://linux.die.net/man/3/pthread_mutex_init) which is more powerful if you need to set up your mutex in special ways. Using the mutex initialization macro introduced in the lecture material, which initializes a mutex with default settings [sufficient for the purposes of this assignment]. The necessary changes will be very small, i.e., not a lot of code is needed. Build and execute the updated program several times.Expected Output:Your program should produce output similar to the following (Note: the order of threads may be different in your case and all iterations for a given thread need not be together): Take a screenshot of a sample output and upload the picture as part of your assignment submission.…arrow_forwardModify the pthread-data-sharing-mutex-os-call.cpp program to apply a Pthread mutex solution, i.e., you will use Linux system calls to control access to the critical region. Note: Mutex initialization can be done in two ways: Using a mutex initialization function (https://linux.die.net/man/3/pthread_mutex_init) which is more powerful if you need to set up your mutex in special ways. Using the mutex initialization macro introduced in the lecture material, which initializes a mutex with default settings [sufficient for the purposes of this assignment]. The necessary changes will be very small, i.e., not a lot of code is needed. Build and execute the updated program several times. Expected Output:Your program should produce output similar to the following (Note: the order of threads may be different in your case and all iterations for a given thread need not be together): Take a screenshot of a sample output and upload the picture as part of your assignment submission.…arrow_forward
- The 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_forwardDo execution paths 3 and 4 encompass the first three conditions for a deadlock to occur?arrow_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
- Write 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_forwardThe ReadableByteChannel instance allows us to read from the Buffers in Datagram Socket using its readmethod.Select one:a. Trueb. Falsearrow_forwardImplementing an arithmetic server using socketsWrite a program with two parts: 1) a client, and 2) an arithmetic server. The job of the client is toaccept input from the keyboard and translate strings that you type into requests to the arithmeticserver. In other words, the client should translate strings such as "3 + 4" into a request to thearithmetic server. There are two versions of this program you have to implement:1. The client and server communicate using UDP.2. The client and server communicate using TCP.You have to submit the following: (a) the client program (b) the server program (c) output showing your program works correctly (you can run both the client and the server on the same computer for generating this output)arrow_forward
- Why are try-catch blocks so important for I/O?arrow_forwardComputer Science Write a Python function that takes in a socket, and reads in bytes from the socket connection until a newline is encountered. All bytes read so far that are even (0, 2, 4, 6, 8) are then returned. Do not handle exceptions; assume all parameters are validarrow_forwardThe following code must be written in python for this HW assignment. I will provide a skeleten for the code and you must write some lines of code to satisfy the objective of the prorgram. You will develop a web server that handles one HTTP request at a time. Your web server should acceptand parse the HTTP request, get the requested file from the server’s file system, create an HTTP responsemessage consisting of the requested file preceded by header lines, and then send the response directly tothe client. If the requested file is not present in the server, the server should send an HTTP “404 NotFound” message back to the client. Put an HTML file (e.g., HelloWorld.html) in the same directory that the server is in. Run the serverprogram. Determine the IP address of the host that is running the server (e.g., 128.238.251.26). Fromanother host, open a browser and provide the corresponding URL. For example:http://128.238.251.26:6789/HelloWorld.html‘HelloWorld.html’ is the name of the file you…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