Operating Systems 101

388 VIEWS

·

Operating Systems 101: Let’s discuss some basics of operating systems from processes, threads and concurrency. We’ll discuss thread needs and how it is initiated by the OS and underlying hardware. 

What Is an Operating System?

An operating system is software running on your computer that manages resources and operations. Some examples are Windows 11, macOS, Ubuntu, and Debian are a few. The operating system acts as an interface for the underlying computer hardware components and the end user. Every computer system needs an operating system in order to run other applications. Applications like browsers, Microsoft Word, or even your favorite note taking program. It is important to note that, it is not possible to use any computer or mobile device without an operating system.

Types of Operating Systems

The OS performs tasks like managing files, processes, and memory. Below are some popular types of operating systems.

  1. Batch Operating System: This type of OS does not interact with the computer directly, this works by having an operator which takes similar jobs and groups them into batches. The operator is responsible for sorting jobs with similar needs.
  2. Time-Sharing Operating System: A time shared operating system allows multiple users to share computers at the same time. Each user will have at least one separate program in memory. The period of time when the user has used a CPU is known as time slice, time slot or quantum.
  3. Distributed Operating System: Multiple processors serve multiple real-time applications and multiple users. Processors communicate with each other through various communication lines. High availability is present in distributed operating systems where resources are shared.
  4. Network Operating System: Software that connects multiple devices and computers on the network and     allows them to share resources. The functions of the NOS are creating and managing user accounts on the network, controlling access, and managing the resources on the network.
  5. Real-Time Operating System: RTOS are used in environments where a large number of events must be    accepted and processed in a short time or within certain deadlines. We measure processing time in tenths of seconds, this is a time-bound system with a fixed deadline. Some examples of RTOS, Airline traffic control systems, and a heart pacemaker.

Operating system types allow for different types of functionality to occur in a more streamlined way. Operating systems are responsible for allowing a user to interact with the machine. Without an OS in place we wouldn’t be able to interact with computers.

Processes, Threads, and Concurrency

What Is a Process?

A new process is started when a command is issued in linux. When a new process is started it is assigned a PID (process identifier). By running the command `ps` in your command line you can see all the current running processes. If you run `ps -f` the -f flag means “full”, you’ll be able to see even more detailed information for the processes running on your machine.

Each process has the following information in the output: 

In the output above you see we have the following:

  • UID: User ID, the ID for the person running the command
  • PID: process ID
  • PPID: parent process ID (the ID)
  • C: CPU utilization of process 
  • STIME: Time the process started
  • TTY: Terminal type associated with the process
  • TIME: CPU time taken by the process
  • CMD: The command that started this process
What Is a Thread?

When a process is kicked off or started like we just covered above, it has to run on some sort of platform. That platform in this case is a thread. A thread of execution is often considered the smallest unit of processing that occurs. A process can have multiple threads of execution running asynchronously. Threads are necessary for efficient processing times on your computer.

Multi-threaded applications will assign multiple threads to a single process like shown in the diagram below. An example of a multi-threaded application could be a word processor, where a thread is checking spelling and grammar, while another thread loads images, and another is taking automatic backups while the document is being edited. 

What Is Concurrency?

Concurrency is the execution of multiple instruction sequences occurring at the same time. When several process threads are running in parallel, that is concurrency happening. The running process threads communicate through shared memory. Concurrency is the sharing of resources which can result in problems like deadlocks and resource starvation for some threads. 

Running processes concurrently has the ability to increase the amount of throughput that can occur with your processes. It’s important to keep in mind however, that the speed at which processes are executed does depend on a few factors such as: 

  • The influence of other processes
  • How the operating system handles interrupts
  • Existing scheduling policies of the operating system

Conclusion

There are different types of operating systems, each one has their own purpose to best suit your needs. Each one will have a similar underlying way of executing tasks.

It’s hard to go a day without interacting with an operating system of any kind. You can find them in your laptop, cell phone, point-of-sale system, even the car you drive. There’s still much more to learn about these systems from how they are designed, and how to determine which type of system is best suited for the task at hand. I hope this article provides you with a glimpse into the world of operating systems and encourages you to want to learn even more about this fascinating topic regarding systems that run our world!


Alicia Luciano is a Platform Infrastructure Engineer with 6 years experience in technology. She has worked with databases as a DBA at a large-scale organization, focusing on ML to predict growth trends for capacity planning strategies. She then dove into SRE type work as an Infrastructure engineer at several startups throughout the Colorado area, where she focuses heavily on monitoring and creating SLIs,SLOs and SLAs for micro-service systems.


Discussion

Click on a tab to select how you'd like to leave your comment

Leave a Comment

Your email address will not be published.

Menu
Skip to toolbar