0% found this document useful (0 votes)
15 views

Operating Systems

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

Operating Systems

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

Operating Systems

• What is an Operating System?


• Software managing hardware: An operating system (OS) is software that manages computer hardware and
provides services for computer programs.
• User interface & control: It acts as an intermediary between users and the hardware, enabling tasks like running
applications, managing files, and controlling peripherals.
• The need for an Operating System
• Initial manual software loading: Early computers lacked built-in operating systems, requiring users to manually
load control software via paper tape, punched cards, or cassette tapes to start the machine, as seen in early home
computers like the Acorn BBC B.
• BIOS and HDD storage: With the development of hard disk drives (HDDs), operating systems were stored on the
disk, and the start-up process was managed by the BIOS, originally stored on a ROM chip but now on flash
memory, with its configuration saved in CMOS memory for easy modification.
• OS functionality: Operating systems load only necessary parts into RAM to optimize performance, providing an
environment for applications, a user-friendly interface, and abstracting hardware complexity. Examples include
Windows, macOS, Android, and iOS.
• HCI options: Users interact with computers via graphical user interfaces (GUIs) or command-line interfaces (CLIs).
While CLIs require typing precise commands, GUIs allow interaction through icons and a pointing device,
simplifying operations like those in WIMP(windows, icons, menu & pointing devices) environments.
• Post-WIMP interaction: Modern devices like smartphones and tablets use post-WIMP interfaces with
touchscreens, enabling intuitive actions such as pinching, rotating, and tapping to interact with applications,
enhancing flexibility beyond traditional pointer-based systems.
• Operating system tasks
• Memory Management
• Memory optimization: Determines how memory is allocated and deallocated for multiple running applications,
tracks memory usage, and swaps data between RAM and storage (HDD/SSD) as needed.
• Memory organization: Manages how much memory is assigned to applications and how it is divided, using
methods such as single allocation, partitioned allocation, paged memory, or segmented memory.
• Memory protection: Prevents multiple applications from accessing the same memory locations simultaneously,
ensuring data integrity, preventing crashes, and safeguarding security.
• Separation of memory tasks: While memory organization determines how memory is divided, memory
protection ensures no overlap occurs, both essential for stable system performance.
• Security Management
• Security management goals: Ensures the integrity, confidentiality, and availability of data by using updates,
antivirus software, firewalls, and setting user privileges.
• Access control and data recovery: Manages user accounts, access rights, and offers data recovery and system
restore to prevent unauthorized access and recover lost or corrupted data.
• Process management
• Manages the allocation of resources and ensures synchronization between processes through techniques like
scheduling, conflict resolution, and queue management to enable efficient data sharing and smooth operation.
• Hardware Management
• Functions of hardware management: Involves communication with input and output devices through device
drivers, translating data into a compatible format, and prioritizing hardware resources for effective use and
release.
• Printer management example: Controls the printing process by loading the printer driver, managing data through
buffers and queues, sending control commands, and handling errors and interrupts from the printer.
• File Management
• Key tasks of file management: Includes defining file naming conventions, performing operations like creating,
opening, deleting, and renaming files, maintaining directory structures, and managing access control mechanisms
such as permissions and password protection.
• File storage and memory allocation: Specifies the logical file storage format (e.g., FAT or NTFS), ensures
appropriate memory allocation by loading files from HDD/SSD into memory, and manages file accessibility for
editing and locking.
• Utility Software
• Operating systems provide various built-in utility programs like hard disk formatter, virus checker, defragmentation
software, and file compression tools.
• Users can install additional utility software, such as virus checkers, which may run continuously in the background.
• Hard disk formatter
• A disk formatter organizes storage space into data blocks (partitions), which are contiguous, and then formats
them by writing directory data and tables of contents (TOC) for the operating system to locate files.
• Formatting, like NTFS in Windows, fills disk sectors with zeros to test the sectors but results in data loss if the drive
has been previously used.
• Disk formatters include non-destructive checking tools to identify and flag bad sectors, replacing them with
unused sectors, though damaged files may become corrupted and should be deleted.

• Virus Checkers
• Virus checkers, offered by operating systems, provide the best defense against malware if kept up to date and
running continuously in the background, checking files before they are run.
• Antivirus software compares potential viruses to a database of known viruses, uses heuristic checking for
suspicious behavior, and quarantines potentially infected files for automatic or user-decided deletion.
• Regular updates and full system scans, such as weekly checks, are essential to detect new viruses or dormant
malware that may evade real-time scanning.
• Defragmentation software
• As an HDD fills up, file data becomes scattered across different sectors, tracks, and surfaces, leading to
fragmentation.
• Fragmentation increases data access time since the HDD's read-write head must move more frequently to retrieve
scattered file pieces. Contiguous storage of files would reduce this delay.
• Consider the following example using a disk with 12 sectors per surface.
• We have three files (1, 2 and 3) stored on track 8 of the disk surface.

• File 2 is deleted by the user and file 1 has data added to it. However, the file 2 sectors which become vacant are
not filled up straight away by new file 1 data since this would require ‘too much effort’ for the HDD resources.

• File 1 has been extended to write data in sectors 10 and 11. Now, suppose file 3 is extended with the equivalent
of 3.25 blocks of data.
• This requires filling up sector 9 and then moving to some empty sectors to write the remainder of the data – the
next free sectors are on track 11.
• If this continues, the files just become more and more scattered throughout the disk surfaces. It is possible for
sectors 4, 5 and 6 (on track 8) to eventually become used if the disk starts to fill up and it has to use up whatever
space is available.
• A disk defragmenter will rearrange the blocks of data to store files in contiguous sectors wherever possible;
however, if the disk drive is almost full, defragmentation may not work.
• Assuming we can carry out defragmentation, then track 8 now becomes:

• Defragmentation reduces the number of read-write head movements needed to access files, improving data
retrieval efficiency.
• Some defragmenters also perform cleanup by marking damaged data blocks as "unusable," preventing future data
from being written to those blocks.
• Disk content analysis/repair software
• Disk content analysis software is used to check disk drives for empty space and disk usage by reviewing files and
file folders.
• This can lead to optimal use of disk space by the removal of unwanted files and downloads (such as the deletion
of auto saving files, cookies, download files, and so on).
• Disk compression and file compression
• File compression is essential to save storage space and make it quicker to download/upload files and quicker to
send files via email.
• Disk compression utilities compress data before writing and decompress it during reading, prioritizing system
operations, and should not be uninstalled, as doing so would make previously saved data unreadable.
• Back-up software
• Operating system backup utilities allow scheduled backups, only backing up files that have changed, with best
practice suggesting three versions: the current file, a local backup, and a remote backup.
• Windows provides features like data restoration, restore points, and file version history through File History, which
creates hourly backups and keeps past file versions unless settings are changed.
• Mac OS Time Machine backs up hourly, keeps daily backups for the past month, and weekly backups for previous
months, automatically deleting older backups when the storage device is full.
• Program libraries
• Program libraries provide pre-written subroutines to help developers save time during software development by
reusing existing code, such as sort routines.
• Dynamic link libraries (DLL) contain subroutines that must be available at runtime, allowing developers to
integrate them into their own programs for efficiency.
• Suppose we are writing a game for children with animated graphics (of a friendly panda) using music routines and
some scoreboard graphics.
• Using pre-written routines from program libraries saves time and cost by avoiding the need to rewrite and retest
common code, promoting efficient and error-free development.
• This approach supports modular programming, enabling multiple developers to work simultaneously, maintain
consistency across related software, and uphold a company's "corporate image.“
• Operating systems utilize two types of program libraries: static libraries, where routines are linked and embedded
into the new program code at compile time, and dynamic libraries (DLL), where routines are linked only at
runtime.
• Dynamic link libraries allow multiple applications to access the same routines as standalone files, saving memory
by loading them into RAM only when needed.
• For instance, a new software program may include a link to a printer routine in a DLL, accessing and loading the
printer code only when the user requires it, rather than including the full routine in the main program.
• Translation and execution of programs
• Translators are systems software that convert programming instructions from languages other than machine code
into executable machine code, with three types of translators, each performing a specific role.
• Instructions in a program can only be executed when written in machine code and loaded into the main memory
of a computer.
• Assemblers
• Assembly language programs are translated into machine code by an assembler, which can either load the
program directly into memory or store it for later execution, requiring a loader program to execute it multiple
times without re-translation.
• Assembly language programs are machine-dependent and specific to a particular type of chip or computer, often
used for tasks requiring high-speed execution, such as operating systems, robotics, or control systems.
• Compilers and Interpreters
• High-level language programs can be translated into machine code by a compiler, which generates a stored object
program that can be executed multiple times without re-translation, or executed line-by-line using an interpreter
without generating a stored program.
• Compiled programs require a loader to load the translated code into memory, while interpreted programs execute
each line during runtime without storing a translated version.
• High-level languages are machine-independent and portable, able to run on various systems if a suitable compiler
or interpreter exists, with common examples including Java, Python, and Visual Basic.
• Compilers and interpreters are both used for high-level languages, with some IDEs offering both; interpreters are
helpful during early development, while compilers create stand-alone programs for repeated execution without
retranslation.
• Partial compiling and interpreting
• Some high-level languages use a combination of compilation and interpretation to optimize execution times,
where source code is compiled into intermediate code (p-code or bytecode), which is machine-independent.
• The intermediate code can then be either interpreted or further compiled for execution, as seen in languages like
Java and Python, where bytecode is executed by a virtual machine interpreter.
• Integrated development environment (IDE)
• An Integrated Development Environment (IDE) helps programmers write and develop programs, with some IDEs
supporting multiple programming languages; examples include NetBeans, PyCharm, Visual Studio, and
SharpDevelop.
• IDEs typically include a source code editor, a compiler or interpreter (or both), a runtime environment with a
debugger, and an auto-documenter.
• Source code editor
• A source code editor allows programmers to write and edit code within the same environment, speeding up
development by eliminating the need for a separate text editor.
• Most source code editors offer features like color coding, pretty-printing, context-sensitive prompts with text
completion, and dynamic syntax checking to enhance coding efficiency and readability.
• Here, string values are shown coloured green and integer values are shown coloured blue.

• Dynamic syntax checking identifies potential syntax errors as the code is being typed, allowing programmers to
correct mistakes before running the program, though logic errors are only detected during execution.
• In larger programs, code blocks can be collapsed into a single line in the editor, helping programmers focus on the
sections currently being developed.
• Compilers and interpreters
• Most IDEs include a compiler and/or interpreter, with the interpreter typically used during development and the
compiler for generating the final object code.
• In PyCharm, multiple interpreters can be configured for different versions of Python, and program results are
displayed through the provided runtime environment.
• A run-time environment with a debugger
• A debugger helps debug programs by allowing the programmer to step through code line-by-line (single stepping)
or set breakpoints to pause execution at specific points, displaying variable contents and evaluated expressions at
those moments to identify logic errors.
• The report window shows the type and value of each variable, with the most recently used one listed at the top,
and also displays results from calculations and other expressions for thorough debugging.
• Auto-documenter
• Most IDEs usually provide an auto-documenter to explain the function and purpose of programming code.

You might also like