Giter Club home page Giter Club logo

exec's Introduction

Author	: Chirag R. Agarwal
ID		: [email protected]
Problem	: Experiencing execv() commands in Linux
Site	: http://agarwalchirag.wordpress.com

FILES IN MY FOLDER :

1) q1_main.c :
	It is the main driver file. It further forks all other processes.
	
2) function.c :
	It is the implementation file. It is the heart of the code.
	
3) HEADER.h :
	It is the header file that contains all the variable and function declarations.

4) input.txt :
	The input file. The input format is as follows (words are '\t' separated) :
	
	7
	ls	-	/bin	-l -a -x
	ps	ls	/bin	-e ax 
	echo	-	-	hello
	pwd	echo	/bin	NULL
	who	pwd	-	-d
	cat	ls	-	floyd.txt
	ifconfig ls 	/sbin	NULL
	
	The first line contains the total number of commands to be executed followed by the commands and dependencies as mentioned in the question.
	
	
5) floyd.txt :
	Just an arbitrary text file that contains some text. It is used to demonstrate the 'CAT' operation.
	
6) Makefile :
	The Makefile.

7) Q1_README :
	What you are reading presently.
	
----------------------------------------------------------------------------------------------

HOW TO EXECUTE MY PROGRAM ?

Simply in the outer folder, type 'make'
This will compile the process and create and executable named 'exe'

Now type './exe input.txt' to execute the program.

If you do not enter the argument, an appropriate error message is displayed on the terminal before exiting.
All the commands are excuted and the output is displayed on the terminal. 
I've added an extra line before executing each command to help distinguish between them.

To clean all the extra files created by the program type "make clean" on the terminal.

---------------------------------------------------------------------------------------------

STRUCTURE :

I've read the input.txt file line by line and stored them in separate arrays arrA and arrB as expected in the question.
The main process forks two child processes A and B and excutes the commands in the arrays arrA and arrB respectively and concurrently.
The processes A and B fork a child everytime a new command is encountered. The next command in that array is executed when this current process successfully terminates.


exec's People

Contributors

chiragragarwal avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.