UNIX System Architecture and Shells
90 Questions
0 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

The software that controls the hardware resources of the computer is called the ______.

kernel

The shaded portion in the diagram represents the ______ that provides an interface to the kernel.

system calls

Applications can use both system calls and libraries of common ______.

functions

The special application that provides an interface for running other applications is called the ______.

<p>shell</p> Signup and view all the answers

When logging in to a UNIX system, we enter our login name followed by our ______.

<p>password</p> Signup and view all the answers

The file that stores user login information in UNIX systems is usually /etc/______.

<p>passwd</p> Signup and view all the answers

In the password file entry, the numeric user ID is represented as ______.

<p>205</p> Signup and view all the answers

Contemporary systems have moved the encrypted ______ to a different file.

<p>password</p> Signup and view all the answers

The names in a directory are called ______.

<p>filenames</p> Signup and view all the answers

The two characters that cannot appear in a filename are the slash character (/) and the ______.

<p>null character</p> Signup and view all the answers

A sequence of one or more filenames, separated by slashes, forms a ______.

<p>pathname</p> Signup and view all the answers

A pathname that begins with a slash is called an ______.

<p>absolute pathname</p> Signup and view all the answers

Two special filenames created in every new directory are . (dot) and ______ (dot-dot).

<p>..</p> Signup and view all the answers

The Research UNIX System restricted a filename to ______ characters.

<p>14</p> Signup and view all the answers

For portability, POSIX.1 recommends that filenames consist of letters, numbers, period, dash, and ______.

<p>underscore</p> Signup and view all the answers

A ______ pathname refers to files relative to the current directory.

<p>relative</p> Signup and view all the answers

The function ______ is used to read one line at a time from standard input.

<p>fgets</p> Signup and view all the answers

The ______ character is often typed as Control-D to signal the end of input.

<p>end-of-file</p> Signup and view all the answers

The program uses ______ to create a new process that is a copy of the caller.

<p>fork</p> Signup and view all the answers

In the child process, ______ is called to execute the command read from standard input.

<p>execlp</p> Signup and view all the answers

To ensure that the command is executed correctly, the program replaces the newline character with a ______ byte.

<p>null</p> Signup and view all the answers

The main process waits for the child process to finish using the ______ function.

<p>waitpid</p> Signup and view all the answers

If fgets returns a null pointer, the loop ______ and the process terminates.

<p>stops</p> Signup and view all the answers

To print the prompt, the program uses the ______ function.

<p>printf</p> Signup and view all the answers

The most common standard I/O function is ______.

<p>printf</p> Signup and view all the answers

The program uses the header ______ to include function prototypes for standard I/O functions.

<p>apue.h</p> Signup and view all the answers

The function ______ reads one character at a time from standard input.

<p>getc</p> Signup and view all the answers

The character read by getc is written using the function ______.

<p>putc</p> Signup and view all the answers

After the last byte of input is read, getc returns the constant ______.

<p>EOF</p> Signup and view all the answers

An executing instance of a program is called a ______.

<p>process</p> Signup and view all the answers

Every process has a unique numeric identifier called the ______.

<p>process ID</p> Signup and view all the answers

The standard I/O constants stdin and stdout are defined in the ______ header.

<p>stdio.h</p> Signup and view all the answers

The program created in the example demonstrates the functions ______ and perror.

<p>strerror</p> Signup and view all the answers

When an error occurs, the program assigns the value ______ to errno to indicate 'No such file or directory'.

<p>ENOENT</p> Signup and view all the answers

Using ______ allows us to know which program generated an error message in a pipeline.

<p>argv[0]</p> Signup and view all the answers

In UNIX coding conventions, passing the program name to perror helps pinpoint the ______ that caused the error.

<p>program</p> Signup and view all the answers

Fatal errors have no recovery actions and require printing an error message to the user or a ______.

<p>log file</p> Signup and view all the answers

System calls usually provide a minimal ______, whereas library functions often provide more elaborate functionality.

<p>interface</p> Signup and view all the answers

The process control system calls (fork, exec, and ______) are usually invoked by the user's application code directly.

<p>waitpid</p> Signup and view all the answers

Resource-related nonfatal errors include codes like EAGAIN, ENFILE, and ______.

<p>ENOSPC</p> Signup and view all the answers

The ______ library function is a common example that simplifies the invocation of system calls.

<p>system</p> Signup and view all the answers

Shared resources being in use can lead to the ______ error being treated as nonfatal.

<p>EBUSY</p> Signup and view all the answers

The typical recovery action for a resource-related nonfatal error is to delay and ______ later.

<p>retry</p> Signup and view all the answers

The ______ library function is often used as a programmer-friendly alternative to the sbrk system call.

<p>malloc</p> Signup and view all the answers

In this text, we'll use the term ______ to refer to both system calls and library functions.

<p>function</p> Signup and view all the answers

Each thread in a multithreaded environment requires a shared copy of errno to function correctly.

<p>False</p> Signup and view all the answers

The value of errno can be both set to 0 and checked when a function indicates success.

<p>False</p> Signup and view all the answers

The perror function outputs an error message based on the specified string and the current value of errno.

<p>True</p> Signup and view all the answers

The function strerror(int *errnum) returns an error message string based on the value of a pointer to errnum.

<p>True</p> Signup and view all the answers

In Linux, errno is defined as a simple global integer variable accessible by all threads.

<p>False</p> Signup and view all the answers

The combination of fork followed by exec is called creating a new thread.

<p>False</p> Signup and view all the answers

The waitpid function is used by the parent process to wait for the child process to finish.

<p>True</p> Signup and view all the answers

Control-D is used to signify the start of input in UNIX systems.

<p>False</p> Signup and view all the answers

To allow arguments in the program, input lines must be parsed to separate the arguments by spaces or tabs.

<p>True</p> Signup and view all the answers

The child process uses execlp to execute a new program file.

<p>True</p> Signup and view all the answers

The ls command can be executed with any specified directory using the current program.

<p>False</p> Signup and view all the answers

Control characters in UNIX systems are formed by pressing the normal key combinations without the control key.

<p>False</p> Signup and view all the answers

The termination status of the child process is ignored in the simple program mentioned.

<p>True</p> Signup and view all the answers

A thread ID from one process is meaningful in another process.

<p>False</p> Signup and view all the answers

Each thread in a process executes on its own stack.

<p>True</p> Signup and view all the answers

The identifier errno is set to a positive value when an error occurs.

<p>False</p> Signup and view all the answers

The open function returns -1 if an error occurs.

<p>True</p> Signup and view all the answers

All functions in UNIX system return a pointer to an object to indicate an error.

<p>False</p> Signup and view all the answers

Threads can access shared data without any need for synchronization.

<p>False</p> Signup and view all the answers

The error constant EACCES indicates a permission problem.

<p>True</p> Signup and view all the answers

Error constants in UNIX begin with the character Z.

<p>False</p> Signup and view all the answers

A fatal error allows for recovery actions to be taken.

<p>False</p> Signup and view all the answers

The error code ENOENT signifies 'No such file or directory'.

<p>True</p> Signup and view all the answers

The perror function in C is used to print an error message associated with a specific error code.

<p>True</p> Signup and view all the answers

Nonfatal errors can always be ignored without consequence.

<p>False</p> Signup and view all the answers

Resource-related nonfatal errors can include temporary issues like resource shortage.

<p>True</p> Signup and view all the answers

The statement 'EACCES: Permission denied' indicates a fatal error condition.

<p>True</p> Signup and view all the answers

Using strerror, you can obtain a string message that describes the error corresponding to a specified error number.

<p>True</p> Signup and view all the answers

The errno variable is used to keep track of error codes for all functions in C.

<p>False</p> Signup and view all the answers

Ignoring a signal is recommended for hardware exceptions like dividing by zero.

<p>False</p> Signup and view all the answers

The default action for a divide-by-zero condition is to terminate the process.

<p>True</p> Signup and view all the answers

Catching a signal involves specifying a function to be executed when the signal occurs.

<p>True</p> Signup and view all the answers

The quit key is typically the Control-C key.

<p>False</p> Signup and view all the answers

A process can send a signal to another process only if it is the owner or the superuser.

<p>True</p> Signup and view all the answers

The process terminates when the SIGINT signal is generated if it has not been set to handle it differently.

<p>True</p> Signup and view all the answers

To generate a signal, one can only use keyboard interrupts.

<p>False</p> Signup and view all the answers

The signal function is called to handle the SIGINT signal by printing a message.

<p>True</p> Signup and view all the answers

The user ID assigned to a user can be changed by the user themselves.

<p>False</p> Signup and view all the answers

Every user in a system has a user ID that is guaranteed to be unique.

<p>True</p> Signup and view all the answers

The superuser or root user has limited permissions in the operating system.

<p>False</p> Signup and view all the answers

Group IDs are used to collect users into groups for resource sharing.

<p>True</p> Signup and view all the answers

Client versions of Mac OS X come with the superuser account enabled by default.

<p>False</p> Signup and view all the answers

The group file in a system maps group names to numeric user IDs.

<p>False</p> Signup and view all the answers

Exponential backoff algorithms involve waiting longer periods in each subsequent retry after an error.

<p>True</p> Signup and view all the answers

The user ID of a user who logs in is presented in the system in decimal form.

<p>True</p> Signup and view all the answers

Study Notes

UNIX Architecture

  • An operating system controls hardware resources and provides an environment for programs to run.
  • The kernel is the core of the operating system, managing hardware resources.
  • The shell is a special application that interacts with users and other applications.
  • System calls provide the interface between applications and the kernel.
  • Libraries of common functions are built on top of system calls, and applications can use either.

Logging In

  • Logging in to a UNIX system involves entering a login name and password.
  • The system looks up the login name in a password file (/etc/passwd).
  • The password file has fields including login name, encrypted password, user ID, group ID, home directory, and shell program.
  • Contemporary systems store encrypted passwords in a different file.

Shells

  • Shells are command-line interpreters that read and execute user input.
  • Shells are used interactively at the terminal, or from files (shell scripts).
  • Common shells include Bourne shell, Bourne-again shell, C shell, Korn shell, and TENEX C shell.
  • The shell to be used is determined by the final field in the user's password file entry.

Files and Directories

  • The UNIX file system is a hierarchical arrangement of directories and files.
  • Directories are files that contain directory entries (filenames and attributes).
  • Filename attributes include file type (regular file, directory), size, owner, permissions, and last modification time.
  • File paths use slashes to denote directories.
  • Paths can be absolute(start with /) or relative.
  • Special filenames, like ".", refer to the current directory, and ".." to the parent directory.

Process and Process ID

  • An executing program is a process.
  • UNIX systems assign a unique numeric ID (PID) to each process.
  • getpid() function returns the process ID.

Time Values

  • Calendar time is the number of seconds since the Unix epoch (January 1, 1970).
  • Process time (CPU time) measures the time a process uses the CPU.

System Calls and Library Functions

  • System calls are the entry points into the kernel for requesting services.
  • System calls are typically implemented as C functions in the standard C library.
  • Library functions provide services, often simplifying or enhancing system calls.
  • The relationship between system calls and library functions is illustrated using malloc and time functions as examples.

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Related Documents

Unix Architecture (Chapter 1)

Description

This quiz covers the fundamentals of the UNIX operating system, including its architecture, kernel, and shell interactions. You'll explore how users log into the system and the role of system calls and libraries. Test your understanding of these essential components of UNIX.

More Like This

Linux Kernel and Distributions
28 questions
Operating Systems Overview
5 questions
UNIX Operating System Structure
5 questions

UNIX Operating System Structure

EffortlessDogwood9877 avatar
EffortlessDogwood9877
Systèmes d'exploitation Unix
14 questions
Use Quizgecko on...
Browser
Browser