Midterm Exam Flashcards
Operating System
Coordinates and applies the various parts of the computer – the processor, the on-board memory, the disk drives, keyboard, video monitors, and mouse to perform useful tasks. The operating system is the central most software program in the machine. It is the mechanism that connects all the internal and external components with administers, programmers, and system users.
Standard input - (stdin)
output - (stdout)
error - (stderr)
In computer programming, standard streams are preconnected input and output communication channels between a computer program and its environment when it begins execution. The three I/O connections are called standard input (stdin), standard output (stdout) and standard error (stderr).
What is a unary operator?
The unary operators operate on a single operand and following are the examples of Unary operators: The increment (++) and decrement (–) operators. The unary minus (-) operator. The logical not (!) operator.
File descriptors (FD) (integral values)
an abstract indicator (handle) used to access a file or other input/output resource, such as a pipe or network socket. File descriptors form part of the POSIX application programming interface.
Standard input: File descriptor 0 is open for reading.
Standard output: File descriptor 1 is open for writing.
Standard error: File descriptor 2 is open reading.
Dependency line
a line with a colon (:)
Data structure
a specific way of storing and organizing data in a computer so that it can be accessed with high efficiently. Data structures can be used as a single place for storing unrelated information
Some common data structures: array, hash table, linked list, queue, and stack
umask file and directory base permissions
666 = default file permission setting 777 = default directory permission setting
Perl data types
singular, array, and hash
Perl utilizes dynamic data typing
in a dynamically typed language, every variable name is (unless it is null) bound only to an object
Perl relational operators (string, and numeric)
Numeric String Meaning > gt Greater than >= ge Greater than or equal < lt Less than <= le Less than or equal
Perl Equality operators (string, and numeric)
Numeric String Meaning
== eq Equal to
!= ne Not equal to
cmp Comparison, sign results
-1 if the left operand is less than right operand
0 If both operands equal to right operand
1 If the left operand is greater right operand
Interpolation
the process of evaluating a string literal containing one or more placeholders, yielding a result in which the placeholders are replaced with their corresponding values
ex: $statement = “I exercise my $animal”;
(string with interpolation)
Single back tick (
) quotes
Used for command substitution.
Example: echo The date is date
(interpolation)
Single quotes
‘ ’ - Literal quotes. Removes the special meaning of all enclosed characters. A single quote cannot appear within single quotes because a single quote denotes the end of the string.
Double quotes
“ “ - Double quotes. Removes special meaning of all enclosed characters, except $, `, “, and .
Example: print “The price is $Price.\n”; (interpolation)
Regular Expression
A regular expression (abbreviated regex or regexp) is a sequence of characters that forms a search pattern, mainly for use in pattern matching with strings, or string matching, i.e. “find and replace”-like operations.
makefile
Make goes through the makefile (descriptor) file first starting with the target it is going to create. Make looks at each of the target’s dependencies to see if they are listed as targets. It follows the chain of dependencies until it reaches the end of the chain and then begins backing out and executing the commands found in each target’s rule. Actually every file in the chain may not need to be compiled. Make looks at the time stamp for each file in the chain and compiles from the point that is required to bring every file in the chain up to date. If any file is missing it is updated if possible.
Inode attributes
The size of the file in bytes.
Device ID (this identifies the device containing the file).
The User ID of the file’s owner.
The Group ID of the file.
The file mode which determines the file type and how the file’s owner, its group, and others can access the file.
Additional system and user flags to further protect the file (limit its use and modification).
Timestamps telling when the inode itself was last modified (ctime, inode change time), the file content last modified (mtime, modification time), and last accessed (atime, access time).
A link count telling how many hard links point to the inode.
Pointers to the disk blocks that store the file’s contents (see inode pointer structure).
Inode number
also called as index number
To check inode number of file use following command, first field in ouput is an inode number.
# ls -il tecadmin.txt
1150561 -rw-r–r– 1 root root 0 Mar 10 01:06 tecadmin.txt
link
A hard link directory entry is a direct pointer to a file inode. A soft link is a pointer to another directory entry.
The ln command is used to create a hard and soft link.
Hard link (physical): ln original_file.txt hard_link.txt
Soft link (symbolic): ln –s original_file.txt soft_link.txt
process
The UNIX kernel can keep track of many processes at one time, and dividing it’s time to other system tasks. Each process submitted to the kernel is assigned a unique process ID (PID). In every version of UNIX, the PID range is 0 through 32,000 and is restrained to 5 digits.
daemon
Daemon processes execute in the background and their existence is under the radar screen. Users don’t know they exist unless they look for them on the system. Daemons execute waiting for data to be passed to them from some application, such as, a database, network, or printer daemon waiting for a print command. Daemon processes normal are known as service providers.
zombie
When a process is terminated or terminates on its own, but only partially exits the system, its presence can be displayed on the system as being in a Z state. This is a zombie, or defunct process on the system. A zombie is a process that completed execution, and is dead (walking dead). It does not consume system resources. It retains an entry in the process table. A good process display command is ps –aux.
orphan
Normally, when a child process is terminated, the parent process receives a SIGCHLD (code 17) signal from the kernel. After the parent receives the SIGCHLD signal, the parent can perform any last minute task or restart a new child process prior to the termination of its child. However, if the parent is terminated prior to its child process, the child process is left without a parent. This situation results in the child process becoming an orphan and the init process becomes its new parent process. The orphan process will then be assigned a PPID of 1.The term used to best describe the init processes action is re-parenting
filehandle
Filehandle is utilized for both input and output files. Most file names are cryptic and are meaningless to programmers. The purpose of a filehandle is to help the programmer remember a simple file name throughout a program.
A filehandle is a name given for a file, device, socket, or pipe.
Filehandle command line format:
open(filehandle, file name, permissions, chmod);
Example: open($FH,$file_name);
pipe symbol
|
Users can connect the standard output of one command into the standard input of another command by using the pipeline operator (|).
interactive process
Processes that require users to be active participants (like processing Excel) must execute in the foreground in order to run. These jobs are termed “interactive,” and must periodically update the display monitor, and accept input from the user, and allow access to the terminal interface.
ANSI
The American National Standards Institute is a private non-profit organization that oversees the development of voluntary consensus standards for products, services, processes, systems, and personnel in the United States.
CLI (first generation) and GUI (second generation)
The textual (command line) and the visual (graphical user) interfaces are the two most common modalities used to support engineers in network and system administration positions. The command line interface is recognized as the first generation and the graphical user interface is considered the second generation. Currently, research is trying to determine the next best interface. The command line interface is known as, “under the hood” method of interacting with the operating system.
Absolute (full) and relative (directory relative to another path) paths
A pathname starting with a slash is called anabsolutepathname, since it always starts at the ROOT.
All other pathnames (with no leading slash) are calledrelativepathnames. These relative pathnames are evaluatedrelative tothecurrent working directory. Relative pathnames (no leading slash) always start in the current directory, not in the ROOT directory.
PATH
The PATH variable sets the path for a session, which is a colon-delimited list of directories in which UNIX-like systems search for executable programs when you type a program name.
PATH=$HOME/bin:/opt/ant/bin:/opt/Lang/jdk1.3.0/j2sdk1_3_0/bin:
/usr/local/bin:/bin:/usr/bin:/opt/mysql/bin:/opt/WWW:/opt/Mail:
/opt/Lang/Perl/lib:/usr/local/lib:/usr/local/ssl/lib:/usr/local/pvm3/include:
/usr/ucb:/opt/sfw/bin:$HOME:.
TERM
holds the name of the current terminal type.
HOME
variable points to your home directory.
All variables (with their associated values) known to a command at execution time constitute its environment.
One way a shell lets you customize your working environment is by using shell variables. A shell variable is an item, known by a name, that represents a value of some type. As the term “variable” implies, the value of a shell variable can be changed.
There are two types of shell variables. First, there are variables that act as off/on switches. Second, there are variables that store a particular value as a string of characters.
/tmp
In Unix and Linux, the global temporary directories are /tmp and /var/tmp. Web browsers periodically write data to the tmp directory during page views and downloads. Typically, /var/tmp is for persistent files (as it may be preserved over reboots), and /tmp is for more temporary files.
/bin
On most Unix-like systems, the /bin directory contains the shell scripts and system commands. This subdirectory to the root directory contains the executable scripts, which are ready to run.
/etc
contains the configuration files for the system.
/proc
includes a directory for each running process, including kernel processes, in directories named /proc/PID, where PID is the process number. Each directory contains information about one process, including: /proc/PID/cmdline, the command that originally started the process.
/dev
The /dev directory contains the special device files for all the devices. The device files are created during installation, and later with the /dev/MAKEDEV script.
makefile
Comments within a makefile (#)
makefile continuation lines ()
The rule tells make both what and how to make a file
The .c suffix extension causes the C compiler to be invoked.
The .o suffix represents a object file.
The .h suffix represents a header file.
The g++ is a compiler, and not a preprocessor.
The g++ builds object code from your C++ program source.
The –c option, compiles source to object code.
The –o option, compiles object code.
What are the two parts of a dependency rule?
1) What files a file is dependent on?
2) Rule that tells how to recompile the file
What are the differences between a makefile and a shell script?
The rules in a makefile are executed based on dependency, and not sequential order. Scripts execute in sequential order.
Perl utilized C Language assignment operators
+= Add AND assignment operator, It adds right operand to the left operand and assign the result to left operand
-= Subtract AND assignment operator, It subtracts right operand from the left operand and assign the result to left operand
= Simple assignment operator, Assigns values from right side operands to left side operand
# Starts a Comment
– Auto Decrement operator decreases integer value by one
*= Multiply AND assignment operator, It multiplies right operand with the left operand and assign the result to left operand
Shell Arguments
$0, $1, $2, $3 …
$#, $?, $$
Executing
./script.sh Hello World
Will make
$0 = script.sh
$1 = Hello
$2 = World
$# - Expands to the number of positional parameters in decimal
$? - Finds the return value of the last executed command
$$ - The process ID - NOT safe for use as temp filename
Perl $_, @ARGV, $, @, and %
$_ = default implied scalar (variable) @ARGV = Array containing command line arguments $ = calls an item from an array ex. print $test[0]; @ = variable prefix for an array % = variable prefix for a hash