The purpose of this assignment is to make sure that the students can work with t
ID: 3600784 • Letter: T
Question
The purpose of this assignment is to make sure that the students can work with the fork, pipe, and dup system calls. It should also grant some insight into how the shell makes input/output redirection work behind the scenes.
For this assignment, you will be writing a single program that enters a loop in which each iteration prompts the user for two, single-line inputs. If the text of either one of the inputs is “quit”, the program should immediately exit. If “quit” is not found, each of these lines of input will be treated as a command line to be executed. These two commands should be executed as if the user had typed command1 | command2 at the shell prompt, meaning that the standard output of the first command gets redirected into the standard input of the second command. (It should be noted that using cin >> will not grab a whole line; you will need to use another function instead.) You will need to be able to split the text entered by the user into the different command line arguments that comprise it. I do not care how this is accomplished, but some possibilities are to use the C function strtok, or a C++ istringstream object. You do not need to worry about escaping special characters when splitting the string for the purposes of this assignment; the split can be performed based on spaces alone. After these commands have both finished executing, your program should prompt for another pair of input commands to run, repeating the process over and over again until the user gives “quit” as input
Requirements
• You may not use the system function to do this. You must make your own child processes, do the appropriate changes to the file descriptors in each of them, and have them use one of the exec calls to run the commands given by the user.
• Use the pipe system call to create the file descriptors used to communicate between the two programs that are run.
• If an error occurs at any point, there should be an appropriate error message printed to the standard error stream.
• Your program must be able to handle user-specified commands that are up to 127 characters long.
• Your program must be able to handle user-specified commands that contain up to five command-line arguments.
• Make sure to close unused pipe file descriptors in all process. If you do not, your program is likely to stall.
• Do not forget that this program involves a loop. After both programs have finished running (but not until), the program should go back to the beginning and prompt for two more commands to run.
• Like all other programming assignments, this must be well-documented.
Explanation / Answer
Human Computer Interaction is a term that you may or may not have heard. So let’s explore what it is, and what role it can play in your Website development.
A Definition
Human Computer Interaction, or HCI, is the study, planning, and design of what happens when you and a computer work together. As its name implies, HCI consists of three parts: the user, the computer itself, and the ways they work together.
The User
When we talk about HCI, we don’t necessarily imagine a single user with a desktop computer. By "user", we may mean an individual user, a group of users working together, or maybe even a series of users in an organisation, each involved with some part of the job or development. The user is whoever is trying to get the job done using the technology. An appreciation of the way people’s sensory systems (sight, hearing, touch) relay information is vital to designing a first-class product. For example, display layouts should accommodate the fact that people can be sidetracked by the smallest movement in the outer (peripheral) part of their visual fields, so only important areas should be specified by moving or blinking visuals. And of course, people like designs that grab their attention. Designers must decide how to make products attractive without distracting users from their tasks.
The Computer
When we talk about the computer, we’re referring to any technology ranging from desktop computers, to large scale computer systems — even a process control system or an embedded system could be classed as the computer. For example, if we were discussing the design of a Website, then the Website itself would be referred to as "the computer".
The Interaction
There are obvious differences between humans and machines. In spite of these, HCI attempts to ensure that they both get on with each other and interact successfully. In order to achieve a usable Website, you need to apply what you know about humans and computers, and consult with likely users throughout the design process. You need to find a reasonable balance between what can be done within the schedule and budget, and what would be ideal for your users.
The Goals of HCI
The goals of HCI are to produce usable and safe systems, as well as functional systems. In order to produce computer systems with good usability, developers must attempt to:
Underlying the whole theme of HCI is the belief that people using a computer system should come first. Their needs, capabilities and preferences for conducting various tasks should direct developers in the way that they design systems. People should nothave to change the way that they use a system in order to fit in with it. Instead, the system should be designed to match their requirements.
The same goals can be applied to Website development. Websites should be usable and safe, as well as functional, so that users can perform the task at hand without any obvious problems or usability errors.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.