Concordia University Concept of Threads and Processes for Execution Responses
POST-1
by Swethadharini Mohan Kumar –
UNIX
UNIX is an operating system that is present in most of the systems that helps in multitasking or multiple user functionality. It behaves like an extended machine or more like a virtual machine making the programming activity a lot more earlier. It has a set of instructions which allows the group of people to access and share the installations. People usually compete for physical resources like processor time, storage space, and peripheral devices, but they can also work together by exchanging programs and data on the same system. These actions are tolerated by the operating system.
The ICT system is an essential part of every business today. Although its so complex an integrated it still plays a vital role in the technical world. Since its so essential, it is under the radar of attack constantly waiting to be exploited by high number of cyber attackers. A model approach called the pwnPr3d which is used to perform automated analysis of any objects that relates to the cyber security. It has an integrated modelling approach which is very useful for the software and hardware components with high level of detailing. This article also talks about how UNIX being an important and very essential operating system of every IT system. This model also helps to rationale the self-replicating malware into UNIX based on its components. (Johnson, 2017)
In UNIX the ability to add process like loading different applications which can be used to command is a useful feature. UNIX works on getting communication set up between one process to another including other mechanical processes. One process can be to write a file while the other process can be written to read the file. It needs to have a file locking in such a way that both reading and writing cannot be done at the same time. Therefore UNIX is preferred. Strickland (2018)
Advantages of UNIX Process includes multitasking with protected memory. A lot of users can login at the same time without interfering in other logins. All users will be authenticated with valid username and passwords associated with files related to those accounts. It has the ability to string comments and utilities together un a lot of ways to achieve complex tasks. It’s a Unified file system where all the data and programs can be accessed at the same place irrespective of the number of physical devices. It is a portable OS system.
Disadvantages of UNIX includes a traditional command is a hostile user which means only programmers can access it not the regular user. The commands usually have cryptic names that gives less response. To use UNIX, it is important to understand the main features. We need to understand how commands and programs interact with each other. It lacks documentations on how to perform different tasks.
References:
Vernotte, P. Johnson, M. Ekstedt and R. Lagerström, “In-Depth Modeling of the UNIX Operating System for Architectural Cyber Security Analysis,” 2017 IEEE 21st International Enterprise Distributed Object Computing Workshop (EDOCW), 2017
Strickland J.R. (2018) One Process, Multiple Threads. In: Raspberry Pi for Arduino Users. Apress, Berkeley, CA
——————————————————————————————————————————————————————-
POST-2
Number of replies: 1
The work performed by an operating system is critical and termed a process. The process is an entity that supplies system resources by the kernel to carry out the task. Priority processes are dependent on the context of which kernel they are switched, and the highly prioritized process can be pre-empted to be performed. A new process in Linux is created with fork (), and each new process is called child which shares all segments as text, stacks, heap, etc. until the newly created process gets/makes changes (Arora, 2021). In the event of modification, the stack and heap segments will be separately produced to ensure changes stay child-specific. The text segment is read exclusive so that parents and children share the same content. Each process in Linux corresponds to a task struct data structure that permits Linux to handle processes on the system. The vector task is a set of pointers to each task struct system data structure. In other words, the maximum system number of processes is restricted by task vector size, and it contains 512 entries by default. Linux offers a real-time process, as well as the usual process type and these processes must respond to external occurrence very fast, and the scheduler treats them differently from a conventional user process.
Linux threads are only a process execution flow. Multi-threaded processes are known as multi execution processes. There are only execution flows in the non-multithreaded process, which is the major execution flows and is also known as single-threaded. No thread concept exists for the Linux kernel. Each thread is regarded by the kernel as a distinct process, although the process differs substantially from others. No planning semantics or data structure representing threads are provided in the Linux kernel. On the contrary, a thread is a process of sharing resources with other processes. Each thread has its own task struct and is shown as usual to the kernel.
Multiple things to happens at the same time is one of the advantages that can be handled by numerous processes, and threads are clones of processes that inter-process the communication which is not easy from an application point of view. It takes a lot of overhead and is comparably sluggish to exchange data between process and context change between the threads is faster than process switching. A PID identifies each process in the system. PID is a number that is assigned by the kernel and reused while the process is exiting. While performing an executable command that executes in a second, also creates a process with a PID number. There were several main reasons why POSIX (Portable Operating System Interface) did not comply with the original thread implementation. PID is one of the main reasons why it did not comply. Red Hat created something called Native Posix Thread Library (NPTL) which would eventually be incorporated into the Linux kernel to solve the difficulties in thread implementation beginning from the 2.6 version of the kernel. While you make a thread using a clone system function, pthread create is preferable.
References:
Arora, H. (2013, November 14). What are Linux Processes, Threads, Light Weight Processes, and Process State. The Geek Stuff. https://www.thegeekstuff.com/2013/11/linux-process-and-threads/.
Informit. InformIT. (2005, April 15). https://www.informit.com/articles/article.aspx?p=370047&seqNum=3.
Difference Between Process And Thread in Linux. slashroot.in. (n.d.). https://www.slashroot.in/difference-between-process-and-thread-linux.
_____________________________________________________________________________________________________
POST-3
Number of replies: 0
Linux OS Control of Processes and Threads
In a Linux operating system, processes and threads are almost the same concepts. The main dissimilarity is that threads usually share similar virtual memory address space. In Linux, a process refers to an instance in the execution of an operation or a program. For instance, when a user launches two browser windows, they run two processes in the same program. The Linux OS holds processes management information in a process control block (PCB) (Dino et al., 2020). Hence, the OS enables a process to be separated into several threads of execution. These threads share all management information of the process except for the information regarding execution, which is maintained in the thread control block. Threads within a process in a Linux operating system can instantiate distinct parts of a program code simultaneously. Besides, they can execute similar parts of a code with different execution states at the same time.
Process in a Linux OS can be visualized as a program running instance in a very basic form (De Oliveira et al., 2019). For instance, when a user opens a text editor in the Linux box, a text editor process will be instantiated immediately. Also, processes can communicate with other processes in the operating system through inter-process communication mechanisms and share data through methods, such as shared memory. A fork() is used to develop new processes in Linux. The new processes initially share all segments like heap, stack, and text. When changes are made, a distinct copy of heap and stack segments is developed for the child process such that all alterations remain child-specific (De Oliveira et al., 2019). The advantage of running a process in Linux is that a user can run other commands in the background instead of waiting for the current program to stop running. One disadvantage of processes is that they are expensive in terms of resources and time. On the other hand, threads enable the utilization of multiprocessor architectures with greater efficiency and offer concurrency within processes. However, one disadvantage of threads is that the entire system is blocked and broken if a single thread breaks.
References
De Oliveira, D. B., De Oliveira, R. S., & Cucinotta, T. (2019, May). Untangling the Intricacies of Thread Synchronization in the PREEMPT_RT Linux Kernel. In 2019 IEEE 22nd International Symposium on Real-Time Distributed Computing (ISORC) (pp. 1-9). IEEE.
Dino, H. I., Zeebaree, S. R., Salih, A. A., Zebari, R. R., Ageed, Z. S., Shukur, H. M., … & Hasan, S. S. (2020). Impact of Process Execution and Physical Memory-Spaces on OS Performance. Technology Reports of Kansai University, 62(5), 2391-2401.
____________________________________________________________________________________________
POST- 4
Number of replies: 0
In a process control block, the operating system stores management information about a process (PCB). A process can be divided into many threads of execution in modern operating systems, which share all process management information except information immediately related to execution.
In the context of the process, one or more threads are active. The operating system assigns processor time to threads as the basic unit. Any section of the process code can be executed by a thread, including bits that are currently being executed by another thread. A job object allows you to manage a group of processes as a single entity.
Objects that implement the Runnable Interface, which means they have a method “public void run“, are required for the creation of new Threads. The thread does not begin to execute when a Thread Object is created; instead, the program must call the Thread’s “start” method.
A process refers to a running program, whereas a thread refers to a section of a process. Threads are lightweight, whereas processes are not. A process takes longer to end, whereas a thread takes less time to terminate. The creation of Process takes longer, whereas the creation of Thread requires less time.
Threads, unlike processes, are not self-contained entities. Unlike processes, every thread in the task has access to every address. Threads, unlike processes, are created to help one another. Because processes can come from various users, they may or may not be able to help one another.
In a multiprocessor architecture, where each thread may run in parallel on a different processor, the benefits of multithreading can be considerably improved. No matter how many CPUs are available, a single-threaded task can only run on one of them. On a multi-CPU machine, multithreading enhances concurrency.
References
Threads advantages and disadvantages