You are on page 1of 8

UNIX AND NETWORK PROGRAMMING UNIT-I 1)What is mean by Shell A Shell is a commandline interpreter that reads user input

and executes commands. !) Whe"e an in#$t t% the Shell is &i'en A user input to a shell is normally from the terminal or sometimes from a file called Shell Script. () What a"e the 'a"i%$s ty#es %) Shell The Bourne Shell The C Shell The Korn Shell *) What is mean by Di"e+t%"y A Directory is a file that contains directory entries. The attributes of a file are type of file,size of the file, owner of the file,permissions for the file and time of last modification of file etc. ,) Whi+h )$n+ti%ns a"e $se- t% &et the att"ib$tes %) the )ile The stat and fstat functions return a structure of information containin all the attributes of a file. .) What a"e the )iles t% be +"eate- /hen -i"e+t%"y is t% be +"eate Two filenames are automatically created whene!er a new directory is created namely dot and dot"dot.# Dot refers to the current directory and dot"dot refers to the parent directory. 0)What is mean by #athname A se$uence of zero or more filenames separated by slashes and optinally startin with a slash forms a pathname. A pathname that be ins with a slash is called an absolute pathname or relati!e pathname. 1)What is the #$"#%se %) /%"2in& -i"e+t%"y %or&in directory is also called as Current wor&in directory. %or&in directory is the directory from which all relati!e pathnames are interpreted. A process can chan e its wor&in directory with the chdir function. 3)What is mean by 4ile Des+"i#t%"s 'ile Descriptors are small nonne ati!e inte ers that the &ernel uses to identify the files bein accessed by a particular process. 15)What a"e the -es+"i#t%"s t% be %#ene- by a shell /hen "$nnin& a ne/ #"%&"am All shells open three descriptors whene!er a new pro ram is run namely standard input standard output and standard error.

UNIT-II 1) 6%/ the #"%+ess +an be te"minateThere are fi!e ways for a process to terminate which are as follows( )*+ormal Termination( a* return from main b* callin exit c* callin ,exit -*Abnormal Termination( a* callin abort b* terminated by a si nal !)What is the -i))e"en+e bet/een exit an- _exit )$n+ti%n 4$n+ti%n _exit 4$n+ti%n exit function performs certain cleanup _exit returns to the &ernel immediately. processin and then returns to the &ernel.
exit

()What is mean by e7it han-le"s %ith A+S. C a process can re ister upto /- functions that are automatically called by exit. These are called exit handlers and are re istered by callin the atexit function. The exit function calls these functions in re!erse order of their re istration. 0ach function is called as many times as it was re istered. *)W"ite a n%te %n the +%mman--line a"&$ments8 %hen a pro ram is executed, the process that does the exec can pass command"line ar uments to the new pro ram.This is part of the normal operation of the 1nix shells. ,) What is mean by En'i"%nment list 0n!ironment list is an array of character pointers, with each pointer containin the address of a null"terminated C strin . The address of the array of pointers is contained in the lobal !ariable environ. .)What is the #$"#%se %) Sha"e- 9ib"a"ies Shared libraries remo!e the common library routines from the executable file, instead maintainin a sin le copy of the library routine somewhere in memory that all processes reference. 0)What a"e the +%ntents %) the En'i"%nment list The 0n!ironment list consists of fi!e C character strin s namely 2340,5AT2,S2066,1S07 and 638+A40. 1)What is the a-'anta&e %) $sin& alloca )$n+ti%n Throu h alloca function, we don9t ha!e to free the space but it oes away automatically when the function returns. 3)What is the #$"#%se %) an en'i"%nment 'a"iables +ormally en!ironment !ariables is set in a shell start"up file to control the shell9s actions.

15)Whi+h #"%+ess is +alle- as S/a##e" 5rocess .D : is usually the scheduler process and is often &nown as the swapper. +o pro ram on dis& corresponds to this process;it is part of the &ernel and is &nown as a System process.

UNIT-III 1)What a"e the 'a"i%$s )%"ms %) +lassi+al IP: The !arious forms of classical .5C includes pipes, '.'3s,messa e $ueues,semaphores and shared memory. !)What a"e the limitati%ns %) Pi#es )* 5ipes are half"duplex.Data flows only in one direction. )* 5ipes can be used only between processes that ha!e a common ancestor. ()Name the system +all /hi+h is $se- )%" +"eatin& #i#es in Uni78 A 5ipe is created by callin pipe function. Syntax(
int pipe(int filedes[2]);

*)State the "$les t% be a##lie- /hen %ne en- %) #i#e is +l%se%hen one end of a pipe is closed, the followin rules apply( )*.f we read from a pipe whose write end has been closed, after all the data has been read, read returns : to indicate an end of file. -*.f we write to a pipe whose read end has been closed, the si nal S.85.50 is enerated. .f we either i nore the si nal or catch it and return from the si nal handler, write returns an error with errno set to 05.50. ,)State the #$"#%se %) popen an- pclose )$n+ti%n The popen and pclose performs the creation of a pipe, the fork of a child,closin the unused ends of the pipe,execin a shell to execute the command and waitin for the command to terminate. .)What is mean by :%#"%+esses A 1nix filter is a pro ram that reads from standard input and writes to standard output. +ormally filters are connected linearly in shell pipelines. A filter becomes a coprocess when the same pro ram enerates its input and reads its output. 0)What is mean by 4I4Os '.'3s are sometimes called named pipes. 5ipes can be used only between related processes when a common ancestor has created the pipe. %ith '.'3s,unrelated processes can exchan e the data. 1)What a"e the $ses %) 4I4Os )*'.'3s are used by shell commands to pass data from one shell pipeline to another, without creatin intermediate temporary files.

-*'.'3s are used in a client"ser!er application to pass data between the clients and ser!er. 3)What is the #$"#%se %) I-enti)ie"s in IP: To send or fetch a messa e to or from a messa e $ueue,the identifier for the $ueue is needed. 15)State the #$"#%se %) ftok )$n+ti%n ftok function is a way of eneratin a &ey from a pathname and pro<ect.D a reed by the client and ser!er.

15*)What a"e the membe"s %) the IP: Pe"missi%n st"$+t$"e struct ipc,perm = uid,t uid> ?@owner9s effecti!e user id @? id,t id> ?@owner9s effecti!e roup id@? uid,t cuid> ?@creator9s effecti!e user id@? id,t c id> ?@ creator9s effecti!e roup id@? mode,t mode> ?@access modes @? ulon se$> ?@slot usa e se$uence number@? &ey,t &ey> ?@&ey@? A>

UNIT-I; 1)What is mean by :%nne+te- -es+"i#t%" .n a TC5 connection,when three"way handsha&e completes,accept function and the return !alue from the function is a new descriptor that is called connected descriptor. Connected descriptor is used for communication with the new client. !)What is mean by S:TP SCT5 stands for Stream Control Transmission 5rotocol. SCT5 is a connection"oriented protocol that pro!ides a reliable full"duplex association. ()What is mean by I:MP .C45 stands for .nternet Control 4essa e 5rotocol. .C45 handles error and control information between routers and hosts. These error messa es are enerated and processed by the TC5?.5 networ&in software itself.

*)What a"e the #"%blems that y%$ en+%$nte" /ith net/%"2 #"%&"ammin& $sin& UDP )*The problem that is encounter with networ& pro rammin usin 1D5 is its lac& of reliability. -*.f a data ram reaches its final destination but the chec&sum detects an error or if the data ram is dropped in the networ&,it is not deli!ered to the 1D5 soc&et and is not automatically retransmitted. ,)What is mean by A-'e"tise- /in-%/ TC5 always tells its peer exactly how many bytes of data it is willin to accept from the peer at any one time. This is called the ad!ertised window. .)When the si<e %) the a-'e"tise- /in-%/ is +han&eThe ad!ertised window size chan es dynamically o!er the time,as data is recei!ed from the sender,the window size decreases but as the recei!in application reads data from the buffer,the window size increases. 0)What a"e the )eat$"es %) S:TP )*SCT5 can pro!ide multiple streams between connection endpoints,each with its own reliable se$uenced deli!ery of messa es. -*SCT5 also pro!ides a multihomin feature,which allows a sin le SCT5 endpoint to Support multiple .5 addresses. 1)What is mean by Th"ee-/ay han-sha2e To establish a TC5 connection, the minimum of three pac&ets to be exchan ed between client and ser!er.This is called as three"way handsha&e.

3)Name the T:P %#ti%ns t% be ass%+iate- /ith S=N se&ment8 )*4SSB4aximum Se ment Size* option. -*%indow Scale option. /*Timestamp option. 15)Menti%n the name %) the states in'%l'e- in T:P +%nne+ti%n establishment ante"minati%n8 There are ))different states are defined for a TC5 connection which are as follows( )*C63S0D -*6.ST0+ /*SC+,7CDD E*SC+,S0+T F*0STAB6.S20D G*C63S0,%A.T #*6AST,ACK H*'.+,%A.T,) I*'.+,%A.T,):*C63S.+8 ))*T.40,%A.T

11)What is mean by Pi&&yba+2in& The ac&nowled ement of the client9s re$uest is sent with the ser!er9s reply.This is called as 5i ybac&in . UNIT-; 1*5)W"ite -%/n the basi+ %#e"ati%n %) the ping #"%&"am An .C45 echo re$uest is sent to some .5 address and that node responds with an .C45 echo reply. These two .C45 messa es are supported under both .5!E and .5!G. 1*1)What is a DNS A D+S is used primarily to map between hostnames and .5 addresses. 1*!)What is mean by Res%$"+e "e+%"-s The D+S is a distributed database systems and entries in the D+S are &nown as 7esource 7ecords. 1*()What a"e the 'a"i%$s ty#es %) Res%$"+e "e+%"-s The !arious types of resource records are as follows( )*A record "" Address 4appin record -*AAAA record "" .5!G Address record /*5T7 record "" 5ointer record E*4J record "" 4ail 0xchan er record F*C+A40 record "" Canonical +ame record 1**)Di))e"entiate System +all an- 4$n+ti%n System :all System calls are entry points into the &ernel and we are able to trace it with tools. 4$n+ti%n 'unction appears to the user to be functions, e!en thou h on some implementations, they may be system calls.

1*,)Name the t%%ls t% be $se- )%" -eb$&&in& +lient>se"'e" a##li+ati%ns8 The tools which are used for debu in client?ser!er applications are as follows( )* sock pro ram -* tcpdump pro ram /* netstat pro ram E* lsof pro ram

You might also like