0% found this document useful (0 votes)
34 views2 pages

Operating System Lab 3 Guide

This document provides instructions for Lab 3 of an Operating Systems course. It covers using commands to view and manage processes, system commands like vmstat and uptime, and using the vi text editor. Students are asked to submit a word file describing their use of commands like pstree, pkill, and uptime, including examples. They must also capture screenshots of using pgrep to view processes, the system task manager, and package installer. All screenshots must include details of the student's account and operating system.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views2 pages

Operating System Lab 3 Guide

This document provides instructions for Lab 3 of an Operating Systems course. It covers using commands to view and manage processes, system commands like vmstat and uptime, and using the vi text editor. Students are asked to submit a word file describing their use of commands like pstree, pkill, and uptime, including examples. They must also capture screenshots of using pgrep to view processes, the system task manager, and package installer. All screenshots must include details of the student's account and operating system.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

FPT University Lab 3 – Operating System

FPT UNIVERSITY
Lab 3 for Operating Systems

Learning outcome
Upon successful completion of this lab, you will be able
 How to use some commands that concert process and access the system attributes
 To use the word processor application (vi)

Process Management

 View the running process on the system uses the ps (process status) command
o Syntax: ps [-option]
o result
PID TTY TIME CMD
2412 tty1 [Link] bash
2433 tty2 [Link] ps
o option:
 -a: view all
 -ax: view all process, even though the process is not concern with tty
 -axl: view all process with the full command
 Stop a process
o Requirement: the PID must be known
o Syntax: kill -9 PID
o Notes: if it is careless, the system is hang

Some System command


 vmstat (view status of virtual memory)
 pstree –np
 pgrep <option> <parameter>: list process following name, properties …
 pkill
 uptime
 free

Editor program: vi
 Syntax: vi <file_name>
 Manipulation
o Press key i: insert or type the content (in the left)
o Press key a: insert or type the content (in the right)
o ESC key: exit to command mode
o The key arrow is used to move in the content
Instructor: Kieu Trong Khanh, [Link] Page 1 of 2
FPT University Lab 3 – Operating System
o Key x: delete a character
o Key dd: delete a row
o Command
 :w: write file
 :q: exit vi
 :wq: write file and exit vi
 :e!: delete all the content that typing after writing file
o Some other key function
 Ctrl G: show the current line
 G: end of file
 1G: begin of file
 nG: goto n line

Submission
Upload the word file to cms describes some questions as
 Present the content of manipulating of some command (including syntax, what
does it for?, capture two of examples for each command) as
o pstree –np
o pkill
o uptime
o free
 Capture the terminal screen using the “pgrep –u root” command. Explain the
result of the capture
 How to open same “Task Manager” as Windows in Linux that shows the
processes tab? Capture that windows (using both command and GUI on
taskbar).
 How to open same “Add/Remove Program” as Windows in Linux that allows to
update or remove the package software to OS? Capture that window.
Requirement
All the capture must be combination with full the windows including your accounts on
the windows and the Linux OS (if it is not, you will be taken 0 mark). Should be use
the capture in windows with jpg format to reduce the file size with your submitting

END

Instructor: Kieu Trong Khanh, [Link] Page 2 of 2

Common questions

Powered by AI

The pkill command offers significant benefits in a multi-user system by allowing administrators to terminate processes based on attributes like name, user, or interpreted command. However, its use must be judicious to avoid unintended disruptions, as it can potentially terminate all processes matching a pattern, including those belonging to other users. Benefits include efficiency in ending processes without needing exact process IDs, crucial for system administration and automation. Drawbacks involve the risk of system instability if integral processes are terminated inadvertently, highlighting the need for strict access control and defined usage protocols to balance power and safety .

Improper use of the kill command can lead to system instability or crashes if critical system processes are terminated. The command 'kill -9 <PID>' forcefully stops a process, bypassing any cleanup routines or data saving measures the process might include. If used carelessly to terminate essential system processes, it can result in unsaved work, data corruption, or system hang, requiring a reboot to recover. This underscores the importance of correctly identifying target processes and understanding their role before executing the kill command .

Proficiency in commands like ps and pkill is foundational for effective system administration. Understanding ps syntax and functionality allows administrators to accurately list and analyze active processes, identify unusual system behavior, and diagnose potential performance or security issues. Meanwhile, knowing how to employ pkill efficiently enables direct and targeted process termination, streamlining system maintenance and troubleshooting tasks. Mastery of these commands ensures administrators can maintain optimal system performance, address user issues promptly, and enhance overall system security and reliability by promptly mitigating threats or resolving resource contention challenges .

The free and vmstat commands are pivotal in providing visibility into the system's memory usage, helping to balance workloads and prevent resource overutilization. The free command displays the amount of free and used memory, which assists in assessing whether more physical memory may be needed. Meanwhile, vmstat offers deeper insights by reporting on system processes, memory, paging, block IO, traps, and CPU activity over defined intervals. By leveraging these commands, users can identify memory leaks, assess if memory swapping affects performance, and plan future resource distribution to maintain optimal system performance .

The uptime command provides essential information regarding how long the system has been running, along with the current time, number of active users, and system load averages for the past 1, 5, and 15 minutes. This data is critical for assessing system performance over time and identifying periods of heavy utilization. By analyzing uptime output, administrators can schedule resource-intensive processes during off-peak hours to optimize performance or troubleshoot situations where system load averages indicate bottlenecks or resource exhaustion .

The 'ps' command is vital for viewing running processes and provides a snapshot of current process states, essential for troubleshooting and system monitoring. Using options like '-a' reveals all processes associated with terminals, whereas '-ax' lists all processes regardless of terminal association, and '-axl' adds full command details. Each option provides increased visibility into process status, which is critical for diagnosing issues or understanding system load. With this information, administrators can effectively manage system performance and preemptively address potential issues indicated by unusual process activity .

Both Windows Task Manager and Linux process viewers like htop or GNOME System Monitor provide a graphical interface to monitor system processes, CPU and memory usage, and system performance. These similarities help users transition between operating systems by providing familiar views of ongoing process activity, enabling easier troubleshooting and management regardless of platform. While the interfaces and specific functions may differ, the core concepts of monitoring and terminating processes, checking resource usage, and managing startup applications maintain consistency across systems, aiding user adaptation .

The vi editor enhances user efficiency through command mode, allowing for quick text manipulation commands without needing a mouse or graphical interface. This can significantly speed up tasks like repetitive editing or code adjustments due to commands like ':w' for writing files or 'dd' for deleting lines. Unlike graphical text editors, vi's reliance on keyboard shortcuts minimizes distractions and enhances focus by keeping the user's hands on the keyboard. Additionally, vi's ability to handle large text files quickly and efficiently further elevates its utility over graphical editors, particularly for experienced users comfortable with its commands .

Accurate capture and interpretation of the pgrep command output are crucial because it helps users rapidly locate process IDs based on specific criteria like process name or user, thereby facilitating efficient process management and automation tasks. The command 'pgrep -u root' lists process IDs started by the root user, which is vital for administration tasks such as verifying essential system services running under root or identifying unauthorized processes initiated with elevated permissions. Misinterpretation or incorrect captures can lead to incorrect process management decisions, impacting system security or stability .

The vi editor functions as a word processor application that allows users to edit files through both insert and command modes. Key functions include pressing 'i' to insert content to the left and 'a' to the right, using 'x' to delete characters, and 'dd' to delete a row. These editing capabilities are critical when managing configuration files or script editing in an operating system. For instance, after using the 'ps' command to identify a process that needs configuration file editing, vi allows manipulation of those files directly. The ability to transition from content insertion to command mode using the ESC key complements operating system commands like ':wq' to write and save changes to files, showing its integration with the broader system command structure .

You might also like