Sunday, November 13, 2022

CPT 304 - Operating Systems Theory & Design

 

(Click here to view larger diagram.)

Introduction and Operating-System Structures

The major functions of an operating system are to control the hardware of a computer and coordinate the use of the hardware among several applications for the use of various users. Operating systems provide a means for the proper use of hardware, software, and data in the operation of the computer. 

There are six major components of an operating system; process control, file management, device management, information management, communications, and protections. Javatpoint.com identifies eight major components, splitting file management into main memory management and secondary storage management and adding network management, which wouldn't necessarily pertain to standalone computers.  

Process control is the component of an operating system that starts and ends programs. If there is an error in the process, the operating system determines what to do with the error in order to keep the computer processing.

File management allows the operating system to create and delete files. It allows us to open, read, write, and close files.

Device management involves several components of the computer. It involves the main memory, drives, and access to files. It also includes the inputs and outputs of devices such as keyboards, mouses, keyboards, monitors, and printers.

Information maintenance can track the amount of time the computer accessed certain information in the memory. It can also track when the memory was last used.

Communication involves interprocess communication. This would involve the message passing between two processes that are taking place. It also involves shared memory between different processes.

Protecting gives the operating system a means for controlling access to the computer’s resources.


Processes, Threads, and Process Synchronization

Processes

A process is a program that is being executed. This is more than just the code of the program. The process includes the current activity in the program, contents in the processor’s registers, and other temporary data.

The process state could be one of five different states of the process:

  •     New - When the process is being created
  •     Running - When instructions are being executed
  •     Waiting – When the process is waiting for an event to occur, such as an input or output
  •     Ready – When the process is waiting to be assigned to a processor
  •     Terminated – When the process is finished being executed

The process block control is also referred to as the task control block. This is where each process is represented in the operating system. The process control block (PCB) would include the following information:

  • Process state – One of the states mentioned above
  • Program counter – The address of the next instruction to be executed
  • CPU registers – Registers vary depending on the computer’s architecture
  • CPU-scheduling information – Process priority, pointers to scheduling queues, or other scheduling information
  • Memory-management information – Could include values of the base and limit registers and page tables or segment tables
  • Account information – Includes the amount of CPU and real-time used, time limits, account numbers, job or process numbers, etc.
  • I/O status information – Includes a list of input/output devices allocated to the process, a list of open files, etc.

Threads

A thread is a basic part of CPU usage. Threads have an ID, a program counter, a register set, and a stack. In a real-life scenario, I can think of a thread as a task that I would perform, such as doing laundry, making dinner, and watching a football game. Some tasks can be performed while performing other tasks, like the three that I listed. Modern computers are great at multitasking. They can take on several tasks and perform them at the same time. One single program could have multiple threads to perform. With a single-threaded process, each of these threads would be performed one at a time. If I were to do each of my three tasks individually. That would take six hours or more. Modern computers perform multithreaded processes to save a lot of time. Many threads can be performed concurrently. When one thread is waiting on an input from the user, the other threads can continue to keep working. In a single-threaded process, waiting on an input would really slow things down.

Critical-section problem 

A critical section is a part of the code that does not allow any other process to occur while the program is in the critical section. The critical-section problem is designing a way that allows for processes to work around the critical sections. A solution to this problem must have the following requirements:

  • Mutual exclusion – If one process is executing its critical section, no other process can execute its critical section.
  • Progress – If no processes are executing their critical section, but some processes are ready to enter their critical section, it must be decided which process will enter its critical section. This cannot be postponed indefinitely.
  • Bounded waiting – A bound is established to limit the number of times that other processes are allowed to begin their critical sections after a request has been made and before the request is granted.

 


CPU Scheduling, Main Memory, and Virtual Memory

Physical memory is the memory that is stored in the hard drive or other memory of a computer. Physical memory is your RAM. It is fast but volatile storage. RAM usage is measured in nanoseconds, while hard drive disk is measured in milliseconds. When the computer runs programs off the physical memory, it takes that data into the RAM where it will use that data to run a program.

Virtual memory is when the computer makes references to where the data is that it will use to run a program. Virtual memory has the illusion of being larger than the actual physical memory. Instead of copying a lot of information into the RAM, the computer will make a reference of where the needed data is and then use it when it is needed.

Physical memory is limited to RAM size, while virtual memory is limited to your hard drive space. Physical memory can access the CPU, while virtual memory cannot access the CPU.


(Click here for additional file storage diagrams that are mentioned below.)


 Mass-Storage Structure, File-System Interface & Implementation, and I/O Systems

The process files that a computer runs and the data files that it stores are stored on different methods of secondary storage. These include hard disks, magnetic tapes, optical disks, and solid-state drives (SSDs). The operating system of a computer provides logical ways of making this data convenient to use. Different operating systems require files to have specific attributes to help identify files. These include the name, identifier, type, location, size, protection, times, date, and user identification. A file directory will view this information in a table, which allows the operating system to view and organize the files in several different ways. These attributes will be used to help a directory search for files, create files, delete files, rename files, list directories, and traverse the file system. Examples of different types of directories are listed below.

Single-level directories are the simplest. All files are files of are located in one directory. This makes the information easy to understand. Searching in a single-level directory is faster when the file sizes are smaller. Creating, deleting, renaming, and updating files are also easier. One limitation of a single-level directory is that it limits the user or users to use unique names for each file. Searching for files takes longer when the directory is larger.

Two-level directories are similar to single-level directories, however, each user has their own user files directory (UFD). This allows multiple users to have files with the same name. Each UFD lists only that user’s files. The master file directory (MFD) is above all of the UFDs. It can be searched to find each user and then their files. Searching files is easier with this type of directory. Users in a two-level directory are unable to share files with other users. A single user cannot have two files with the same name.

Tree structure directories provide many advantages and are widely used. Every file has a unique pathname. There is a much smaller chance of having name collisions. Searching for files in a tree structure directory is easier. Paths to each file are well laid out. In tree directories, the same file may be saved into multiple directories, which would make this type of directory less efficient and potentially lead to the user having several different versions of the same file. File sharing is not allowed in tree structure directories.

 


Protection and Security

Outline the goals and principles of domain- and language-based protection in a modern computer system and describe how an access matrix is used to protect specific resources a process can access. (Consider using a matrix representation to illustrate concepts.)

Goals and Principles of domain and language-based protection:

One of the goals and principles of domain and language-based protection is to dictate that the programs, users, and systems are given just enough privileges to perform their tasks with need-to-know access. If given too many privileges, accidental or malicious corruption or loss of files can occur. A matrix, like the one below, gives programs or domains (left column) permission to perform allowed functions on the objects (and printer) shown in the top row.

How security is used to protect from threats:

Computers, programs, systems, and networks are vulnerable to numerous security threats. These possible security violations include breaches of confidentiality, integrity, and availability, as well as theft of service and denial of service. Security measures are carried out on four levels to protect systems: physical, human, operating system, and network. Physical security is allowing or denying access to the actual physical equipment. Human security involves allowing login access to systems. This involves keeping passwords secure and private. Users must learn to identify and avoid phishing schemes and other attempts to gain password information. Operating systems protect themselves from accidental or purposeful security breaches. Network security protects break-ins from outside sources. It protects our systems from trojan horses, viruses, worms, and other security breaches aimed at stealing, corrupting, or deleting passwords, sensitive information, and other files. Operating systems and network security are constantly facing newer challenges and must be updated frequently as a result.

Summary

I learned many responsibilities of operating systems in this class. I can't quite imagine which of these I would use in the future. I would imagine that if I got more into programming and took several more programming classes, I would learn much more about processes and how they would affect my programs. I think the same would hold true for dealing with the usage of physical and virtual memory while a program is running. I believe that file storage would be very important in any aspect of Information Technology that I find myself in in the future. File storage, access, and sharing are very important in any office setting that I can imagine. Everyone involved in computers has at least a small amount of responsibility when it comes to protection and security. I believe that I will learn a lot more about protection and security while I am working on my degree, and when I find a career in IT, my responsibilities could be critical to a project or organization. As I get closer to my graduation date, I would like to look back at this course and see how much more I learned about these parts of operating systems. 

(Click here for my full operating system concept map.) (Click here for the drawio file.)

References

Components of Operating System - javatpoint. (n.d.). Www.javatpoint.com. https://www.javatpoint.com/components-of-operating-system

Protection in OS: Domain of Protection, Association, Authentication. (2021, March 1). GeeksforGeeks. https://www.geeksforgeeks.org/protection-in-os-domain-of-protection-association-authentication/

Silberschatz, A., Peter Baer Galvin, & Gagne, G. (2014). Operating system concepts. Wiley.

 

No comments:

Post a Comment

I Have Completed My Degree in Computer Software Technology

Today is the day that I have been looking forward to for the last couple of years. I have put a lot of hard work and dedication into my stud...