Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
7 views

Operating System

Uploaded by

riyajain1040
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Operating System

Uploaded by

riyajain1040
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Lecture 8

### Lecture Notes: User Operating System Interface

---

#### 1. **Introduction to User Operating System Interface**

- The user interface is a crucial service provided by the operating system.

- A user interface allows the user to interact with the operating system.

#### 2. **Types of User Interfaces**

- Two fundamental approaches for user interaction:

1. **Command-Line Interface (CLI)**: Users enter text commands to perform tasks.

2. **Graphical User Interface (GUI)**: Users interact via visual elements (menus, buttons, etc.).

#### 3. **Command-Line Interface (CLI)**

- Also known as the **command interpreter**.

- Users must enter specific commands to execute tasks.

- Advantages:

- Powerful and flexible for users who know the commands.

- Allows direct control of the operating system.

- Disadvantages:

- Requires users to memorize commands.

- **Examples of Command-Line Interfaces:**

- **Windows**: Command Prompt (CMD).

- **Linux**: Terminal.

#### 4. **Graphical User Interface (GUI)**

- Commonly used, user-friendly.

- Utilizes visual elements like desktops, menus, icons.

- Interactions happen via mouse, keyboard, or touch.


- **Example**: While watching this video, you likely used a GUI.

#### 5. **Shells in Command-Line Interface**

- Some systems offer multiple command interpreters called **shells**.

- Examples: Bourne Shell, C Shell, BASH (Bourne-Again Shell), Korn Shell.

#### 6. **Task Execution in CLI**

- Two approaches for executing tasks:

1. **Command interpreter contains the code**: The CLI has built-in code to execute commands.

2. **Command interpreter calls external programs**: CLI calls external programs to perform tasks.

#### 7. **Example: Using CLI in Linux and Windows**

##### **Linux Example (Linux Mint)**

- Task: Create and delete directories on the desktop.

1. Open terminal (`Ctrl+Alt+T`).

2. Navigate to the desktop: `cd Desktop`.

3. Create directories: `mkdir Myfile1` and `mkdir Myfile2`.

4. List files: `ls`.

5. Delete directories: `rm -rf Myfile1` and `rm -rf Myfile2`.

##### **Windows Example (Windows 7)**

- Task: Create and delete directories on the desktop.

1. Open Command Prompt (`Start > cmd`).

2. Navigate to the desktop: `cd Desktop`.

3. Create directories: `mkdir Myfile1` and `mkdir Myfile2`.

4. List files: `dir`.

5. Delete directories: `rmdir Myfile1` and `rmdir Myfile2`.

#### 8. **Comparison with Graphical User Interface (GUI)**

- In GUI, tasks are performed with clicks, not commands.

- Example: To create a folder, right-click > New > Folder.


- To delete, right-click > Delete or press 'Delete' on the keyboard.

#### 9. **Conclusion**

- The user interacts with the operating system through interfaces (CLI or GUI).

- CLI offers more control but requires memorization, while GUI is user-friendly and intuitive.

---

Lecture 9

### Lecture Summary: Understanding System Calls

1. **What are System Calls?**

- System calls provide an interface to the services available by the operating system.

- Programs use system calls to request access to resources like memory, hardware, etc.

2. **Modes of Program Execution:**

- **User Mode:**

- Programs do not have direct access to hardware resources.

- If a program crashes, the system remains unaffected.

- **Kernel Mode:**

- Programs have privileged access to system resources.

- A crash in this mode can cause the entire system to halt.

3. **Context Switching:**

- When a program running in user mode requires system resources, it makes a system call, which
switches the execution to kernel mode, known as **context switching**.

- After resource access, the program switches back to user mode.

4. **Defining System Calls:**


- System calls are programmatic ways for a program to request services from the kernel.

- They are available as routines in programming languages like C and C++.

5. **Example: Copying Files with System Calls**

- **Step-by-Step Breakdown:**

- **Input File Name:** A system call is made to get the input file name from the user (via
keyboard or mouse).

- **Output File Name:** Another system call is made to get the output file name.

- **Open Input File:** The program uses a system call to open the input file.

- **Create Output File:** If the output file doesn’t exist, a system call creates it; if it does, the
program aborts via a system call.

- **Copying Data:** The program uses system calls in a loop to read from the input file and write
to the output file.

- **Close Files:** System calls are made to close both input and output files.

- **Completion Message:** A final system call writes a message to the screen indicating the
completion of the process.

6. **Takeaway:**

- Even for simple tasks, multiple system calls are executed.

- Thousands of system calls may be executed per second during program execution.

- System calls are essential for programs to access operating system services.

This lecture provides a basic understanding of system calls, their function, and their importance in
program execution. Future lectures will delve into the different types of system calls.

Lecture 10

Here are structured notes based on your content regarding the types of system calls:

---

### **Types of System Calls**

System calls can be broadly categorized into five major categories:


1. **Process Control**

- System calls that manage and control processes.

- Examples:

- **End/Abort**: Terminates a process (normally or abnormally).

- **Load/Execute**: Loads and executes a process.

- **Create/Terminate Process**: Creates or terminates processes.

- **Get/Set Process Attributes**: Retrieves or sets process attributes.

- **Wait for Time/Event**: Allows a process to wait for a specific time or event.

- **Signal Event**: Signals an event for processes.

- **Allocate/Free Memory**: Allocates and frees memory for a process.

2. **File Manipulation**

- System calls for managing files.

- Examples:

- **Create/Delete File**: Creates or deletes a file.

- **Open/Close File**: Opens or closes a file.

- **Read/Write/Re-position**: Reads from, writes to, or repositions within a file.

- **Get/Set File Attributes**: Retrieves or sets attributes of files.

3. **Device Management**

- System calls for managing I/O devices.

- Examples:

- **Request/Release Device**: Requests or releases a device for a process.

- **Read/Write/Re-position**: Performs read, write, or repositioning operations on devices.

- **Get/Set Device Attributes**: Retrieves or sets attributes of devices.

- **Attach/Detach Device**: Logically attaches or detaches a device (e.g., ejecting a pen drive).

4. **Information Maintenance**

- System calls for maintaining system information.

- Examples:
- **Get/Set Time/Date**: Retrieves or sets the system time and date.

- **Get/Set System Data**: Retrieves or sets various system data.

- **Get/Set Process, File, Device Attributes**: Retrieves or sets attributes related to processes,
files, or devices.

5. **Communication**

- System calls that manage communication between processes and devices.

- Examples:

- **Create/Delete Communication Connection**: Establishes or terminates connections between


processes.

- **Send/Receive Messages**: Sends or receives messages between processes.

- **Transfer Status Information**: Transfers the current status of a process.

- **Attach/Detach Remote Devices**: Attaches or detaches remote devices to/from the system.

---

### **Recap of Categories:**

1. **Process Control**

2. **File Manipulation**

3. **Device Management**

4. **Information Maintenance**

5. **Communication**

Each category groups system calls based on their functionalities, allowing the operating system to
handle processes, files, devices, information, and communication efficiently.

You might also like