Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Can you please write C program that will act as a shell interface that should accept and execute a rm[ ] command in a separate process. There should be a parent process that will read the command and then the parent process will create a child process that will execute the command. The parent process should wait for the child process before continuing. This program should be written in C and executed in Linux.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- 2 Project Specification In this project, you are required to do socket programming in C language (Linux environment) to implement a pair of client and server that can achieve simple password verification to indicate the current market value of the stock. Your client will send a pair of username and password to your server and your server will verify whether the pair of username and password is legitimate or not for retrieving the stock value. Assume the only legitimate pairs of usernames and passwords that will be accepted by your server are as follows. Username Password Stock Value welpa23e ghqwo31a lcid mrvl snap cl1 bro CVS tyjli14d rjwqe83f gnmds28z rhkt187c 13.93 41.23 10.21 85.09 56.43 91.34 Table 1: Content of StockFile.txt Specifically, your client and server programs entail to achieve the following requirements: 1. Your client program needs to take two arguments that specify the name of server and the port that it is trying to connect to. Your program for server needs to take…arrow_forwardWrite two c++ programs to implement a distributed version of a multithreaded Huffman decompressor using the one in project 1 The server program The user will execute this program using the following syntax: ./exec_filename port_no < input_filename where exec_filename is the name of your executable file, port_no is the port number to create the socket, and input_filename is the name of the file with the alphabet's information. The port number will be available to the server program as a command-line argument. The server program receives from STDIN the alphabet's information (using input redirection). The input file has multiple lines, where each line contains information (character and frequency) about a symbol from the alphabet. The input file format is as follows: A char representing the symbol. An integer representing the frequency of the symbol. Example Input File: E 3 G 3 F 1 H 2 Given the previous input file, the expected output for the server program is: Symbol: C,…arrow_forwardWrite a small program in any language other than bash (python, C, C++ etc.) to read the contents of the given file one line at a time, and output each line at specified time intervals. This small program will form the basis for further demonstrations. Submit code and output to D2L dropbox. The filename must be read from the commandline The time interval must be setas a commandline option in milliseconds. The output must go to stdout Output the env of your new process to a file strace your process and save the output to a file оооо оarrow_forward
- Hello im looking for some direction as to how to approach a homework question. At the moment im stuck because im trying to use scanf() with execlp in order to solve the question. Here is the question: Write a special simple command interpreter that takes a command and its arguments. This interpreter is a program where the main process creates a child process to execute the command using exec() family functions. After executing the command, it asks for a new command input ( parent waits for child). The interpreter program will get terminated when the user enters quit. I'm just looking for direction, not to have someone solve it.arrow_forwardWrite a Java application that will accept two filenames (text files) as command line arguments and use two threads to read contents from the two text files. Each of the threads should sleep for a random time after displaying filename with each line.arrow_forwardWrite a C program that, given a text file, constructs Huffman code based on the character frequencies of the file and then encodes the file accordingly. The executable must accept the following command line options:• -i filename for the input file • -o filename for the output filearrow_forward
- Description:The project I am working on needs to demonstrate how two processes (parent and child) can communicatethrough a shared memory region, with the child process writing a value to the shared memoryand the parent process reading that value. This is my code and I wont run. Can you help: #include <stdio.h>#include <stdlib.h>#include <sys/types.h>#include <sys/ipc.h>#include <sys/shm.h>#include <unistd.h> #define SHM_SIZE 1024 /* shared memory size */ void error_exit(const char *msg) { perror(msg); exit(EXIT_FAILURE);} int main() { key_t key; int shmid; char *data; // Create a unique key for shared memory if ((key = ftok("shared_memory.c", 'R')) == -1) { error_exit("ftok"); } // Create the shared memory segment if ((shmid = shmget(key, SHM_SIZE, 0644 | IPC_CREAT)) == -1) { error_exit("shmget"); } // Attach the shared memory segment to our data space data = shmat(shmid, (void *)0, 0); if…arrow_forwardYou'll write a C++ program to demonstrate thread synchronization. Your main function should first create an empty file called *sync.txt*. Then it will create two separate threads: *Thread-A* and *Thread-B*. Both threads will open *sync.txt* and write to it simultaneously. *Thread-A* will write the numbers 0 through 9, a total of fifty-thousand times in nested `for` loops, then exit. In other words, print the numbers 0 through 9 over and over again, with each run on a separate line, for 50,000 lines. Here's an example of one such line: ```text 0 1 2 3 4 5 6 7 8 9 ``` Somewhat similarly, *Thread-B* will write the letters A through Z fifty-thousand times in nested `for` loops, then exit. In other words, print the letters A through Z over and over again, with each run on a separate line, for 50,000 lines. Here's an example of one such line: ```text A B C D E F G H I J K L M N O P Q R S T U V W X Y Z ``` Do not write each line as one long string. You must write each character to the…arrow_forwardWrite a shell program that renames all files in the current directory. It should remove all vowels from the filenames. For example, apple.txt should be renamed ppl.txt. If the resulting filename is an empty string, then the file should not be renamed.arrow_forward
- Part II: Processes and Threads. Write a C program that will creates a child process. The child will ask the user to enter an integers x and then sends it to the parent via pipe. The parent should print your student's ID if x > 0 or your full student name if x 0 and 01998877 if x <= 0. Note: cach student should print his own id and name as they appear on the UMS. The inter-processes communication should be using pipes.arrow_forwardYou shall implement a Microshell, “MSH”. MSH shall provide the following functions: Provide a shell-like interface for launching new programs: When MSH starts running, it will print a prompt "cssc0000% " (replace cssc0000 with your username) and then wait for the user to type in a file name. Note, MSH will NOT have any shell built-in functions (such as cd, setenv, printenv, bg, fg, etc), with the exception of #5 (below). When the user enters a filename and hits the “enter” key, MSH then reads the filename entered and determines if the file is an executable file. If it isn't, MSH will print a useful error message to the user and then return to #1 above (display a new prompt and wait for user input). If it is an executable file, then MSH will create a new process and run this program in the new process. Note – you will need to determine whether the filename is a fully qualified path name or if the file needs to be searched for (fully qualified pathnames begin with a slash (i.e. "/"),…arrow_forwardIn this assignment, you will implement the shell “engine” as the “group” component, where all members are responsible for the following functionality: • A Command-Line Interpreter, or Shell Your shell should read the line from standard input (i.e., interactive mode) or a file (i.e., batch mode), parse the line with command and arguments, execute the command with arguments, and then prompt for more input (i.e., the shell prompt) when it has finished. 1. Interactive Mode In interactive mode, you will display a prompt (any string of your choosing) and the user of the shell will type in a command at the prompt.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