Free Essay

Process and Thread

In:

Submitted By xzcqe
Words 255
Pages 2
1. (1)Process is a run activity on the set of data in the computer program. It is a basic unit for system to allocate and schedule and the foundation of operation system architecture.
(2)Process is a data structure to represent the inherent laws of dynamic system clearly and manage and schedule the run of program efficiently in the main memory of computer system.

2. (1)Thread is the minimum unit to operate and schedule in the operation system and it is the actual execution unit in the process.
(2)Thread manage the file and control the communication in servers and deal with foreground and background program asynchronously.

3. The difference between process and thread are as follows:
(1) The address space and other resources of different processes are independent, however, different threads share the resources in a process.
(2) Process communicate with other processes under IPC, however, threads can read and write the data segment in process to communicate with each other.
(3) The switch of context in thread is much faster than that in process.
(4) Process is not a executable entity in a multithreaded operation system, but thread is.

4. Benefits: (1) It is easier to schedule and manage with process and thread.
(2) It can be easy and efficient to achieve concurrency through threads. Process can create multiple threads to execute different parts of the same program.
(3)It can develop the function of multi-processors fully and enable the concurrency of programs through the creation of multithreaded process.

Similar Documents

Free Essay

Linux

...THREADS MANAGEMENT IN LINUX OPERATING SYSTEM Thread of execution is the smallest sequence of programmed instructions that can be managed independently by an operating system scheduler. The scheduler itself is a light-weight process. The implementation of threads and processes differs from one operating system to another, but in most cases, a thread is contained inside a process. Multiple threads can exist within the same process and share resources such as memory, while different processes do not share these resources. In particular, the threads of a process share its code and its context . On a single processor, multithreading is generally implemented by time-division multiplexing (as in multitasking): the processor switches between different threads. This context switching generally happens frequently enough that the user perceives the threads or tasks as running at the same time. On a multiprocessor or multi-core system, threads can be truly concurrent, with every processor or core executing a separate thread simultaneously. Many modern operating systems directly support both time-sliced and multiprocessor threading with a process scheduler. The kernel of an operating system allows programmers to manipulate threads via the system call interface. Some implementations are called a kernel thread, whereas a lightweight process (LWP) is a specific type of kernel thread that shares the same state and information. Threads are created like normal tasks, with...

Words: 993 - Pages: 4

Free Essay

How Multithreading Works in a Server

... 1. How multithreading works in a server Multithreading occurs when a process executing an application, is divided into threads that can run concurrently. Multithreading is useful for applications that perform a number of essentially independent tasks that do not need to be serialized. When a multithreaded application is active in a server, the events that occur take place in three phases: i. Start-up phase- requests come in and are handed to a thread for processing. ii. Work phase- in this phase multiple client requests are handled concurrently in multiple contexts. The system allocates a separate thread for each request. In response to clients’ requests for a service, the server dispatcher creates multiple threads in one server that can be assigned to various client requests simultaneously. Each thread is associated with a separate context or request to the server. This feature is useful in both conversational and RPC servers which otherwise may stay idle waiting for the client side of a conversation. iii. Completion phase- When the application is shut down or stopped, the server performs any termination processing that is necessary such as closing a resource manager. 2. Advantages and Disadvantages of implementing multithreading As user space threads * Switching threads is faster when thread management is done in user space. * Fast thread switching. * Fast thread scheduling. * A multithreaded program operates faster on computer systems...

Words: 853 - Pages: 4

Free Essay

Comp3511 Hw1 Solution

...Fall 2011 COMP 3511 Homework Assignment #1 Solution Handout Date: Sept. 22, 2011 Due Date: Oct. 6, 2011 Name: ______________ ID: ___________________ E-Mail: _____________ COMP 3511 L __ Please read the following instructions carefully before answering the questions:  You should finish the homework assignment individually.  There are a total of 4 questions.  When you write your answers, please try to be precise and concise.  Fill in your name, student ID, email and Section number at the top of each page. Submissions without this information will be discarded.  Please fill in your answers in the space provided, or you can type your answers in a Word file.  Homework Collection: the hardcopy is required and the homework is collected at the collection box (#6, #7) or in class. (22 points) Please answer the following question in 2-3 sentences 1) (8 points) What is the benefit of Direct Memory Access (DMA)? Is interrupt still needed when a DMA is used? Can DMA operations possibly interfere with CPU operations? 1. Answer: This frees up the CPU during I/O operation, so the CPU can be better used; Or to improve the CPU utilization (3 points). Interrupt is still needed when the DMA operation is completed in order to inform the CPU (2 points). If a DMA and CPU access memory at the same time, it can interfere with each other (3 points). 2) (4 points) Why is it necessary to separate user mode and kernel mode? Answer: This provides some level of protection so that user programs...

Words: 1136 - Pages: 5

Premium Essay

Nt1330 Unit 1 Question Paper

...forward is required. It is used to maintain the job queues. It is used to maintain the thread queues. It also used to maintain the I/O request etc… Stack is used to store the registers, flags and other details of process or thread during interrupts or system call. Operating system uses these data structures to perform various tasks for example. Operating system uses stack while we use UNDO option it follows stack data...

Words: 1498 - Pages: 6

Free Essay

Death Penality

...Chapter 4: Threads Operating System Concepts – 9th Edition Silberschatz, Galvin and Gagne ©2013 Chapter 4: Threads  Overview  Multicore Programming  Multithreading Models  Thread Libraries  Implicit Threading  Threading Issues  Operating System Examples Operating System Concepts – 9th Edition 4.2 Silberschatz, Galvin and Gagne ©2013 Objectives  To introduce the notion of a thread—a fundamental unit of CPU utilization that forms the basis of multithreaded computer systems  To discuss the APIs for the Pthreads, Windows, and Java thread libraries  To explore several strategies that provide implicit threading  To examine issues related to multithreaded programming  To cover operating system support for threads in Windows and Linux Operating System Concepts – 9th Edition 4.3 Silberschatz, Galvin and Gagne ©2013 Motivation  Most modern applications are multithreaded  Threads run within application  Multiple tasks with the application can be implemented by separate threads     Update display Fetch data Spell checking Answer a network request  Process creation is heavy-weight while thread creation is light-weight  Can simplify code, increase efficiency  Kernels are generally multithreaded Operating System Concepts – 9th Edition 4.4 Silberschatz, Galvin and Gagne ©2013 Multithreaded Server Architecture Operating System Concepts – 9th Edition 4.5 Silberschatz, Galvin and Gagne ©2013 ...

Words: 1284 - Pages: 6

Free Essay

Cpu Scheduling

...Concepts Scheduling Criteria Scheduling Algorithms Thread Scheduling Multiple-Processor Scheduling Operating Systems Examples Algorithm Evaluation Operating System Concepts – 8th Edition 5.2 Silberschatz, Galvin and Gagne ©2009 Objectives    To introduce CPU scheduling, which is the basis for multiprogrammed operating systems To describe various CPU-scheduling algorithms To discuss evaluation criteria for selecting a CPU-scheduling algorithm for a particular system Operating System Concepts – 8th Edition 5.3 Silberschatz, Galvin and Gagne ©2009 Basic Concepts    Maximum CPU utilization obtained with multiprogramming CPU–I/O Burst Cycle – Process execution consists of a cycle of CPU execution and I/O wait CPU burst distribution Operating System Concepts – 8th Edition 5.4 Silberschatz, Galvin and Gagne ©2009 Alternating Sequence of CPU and I/O Bursts Operating System Concepts – 8th Edition 5.5 Silberschatz, Galvin and Gagne ©2009 Histogram of CPU-burst Times Operating System Concepts – 8th Edition 5.6 Silberschatz, Galvin and Gagne ©2009 CPU Scheduler   Selects from among the processes in ready queue, and allocates the CPU to one of them  Queue may be ordered in various ways Switches from running to waiting state Switches from running to ready state Switches from waiting to ready Terminates CPU scheduling decisions may take place when a process: 1. 2. 3. 4.   Scheduling under 1 and...

Words: 3375 - Pages: 14

Free Essay

A Road Map Through Nachos

...A Road Map Through Nachos Thomas Narten Department of Computer Sciences Levine Science Research Center Duke University Box 90129 Durham, N.C. 27708-0129 narten@cs.duke.edu January 4, 1995 Abstract Nachos is instructional software that allows students to examine, modify and execute operating system software. Nachos provides a skeletal operating system that supports threads, user-level processes, virtual memory and interrupt-driven input output devices. Nachos is a complex piece of software and it is di cult for beginning students (and instructors) to easily gain on overall understanding of the various system pieces and how they t together. This document provides a road map to understanding the Nachos system. It gives a high-level overview of the source code, focusing on the big picture rather than on the details. It is not intended as a replacement for reading the source code. Rather, it is a companion that is intended to help students (and instructors) overcome the initial learning curve encountered when learning and using the system. Contents 1 Introduction to Nachos 2 Nachos Machine 2.1 2.2 2.3 2.4 Machine Components : : : : : : Interrupt Management : : : : : Real-Time Clock Interrupts : : Address Translation : : : : : : : 2.4.1 Linear Page Tables : : : 2.4.2 Software Managed TLB 2.5 Console Device : : : : : : : : : 2.6 Disk Device : : : : : : : : : : : 1 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :...

Words: 8320 - Pages: 34

Free Essay

Prg/211 - Process Management

...Process management is the ensemble of activities of planning and monitoring the performance of a process. Process management is the application of knowledge, skills, tools, techniques and systems to define, visualize, measure, control, report and improve processes with the goal to meet customer requirements profitably (Wikipedia, 2012). This is not specific to OS X, instead it is also the standard for Unix. In place of a gigantic OS and user interface setting, Unix and the Mach kernel on which OS X is based both operate as collections of a large number of cooperating programs. These programs generate the illusion and useful understanding of a unified interface, but deliver significantly more flexibility in the user's capability to change things that suit his or her certain needs. Processes Vs. Threads A process, in the simplest terms, is an executing program. One or more threads run in the context of the process. A thread is the basic unit to which the operating system allocates processor time. A thread can execute any part of the process code, including parts currently being executed by another thread. In Linux, processes and threads are almost the same. The major difference is that threads share the same virtual memory address space. According to Apple, Mac OS X processes and threads are implemented on top of Mach tasks and threads, respectively. A thread is a point of control flow in a task. A task exists to provide resources for the threads it contains. This split is made...

Words: 567 - Pages: 3

Free Essay

Soy Full O Chick

...called a process. Some operating systems use the term ‘task‘ to refer to a program that is being executed. A process is always stored in the main memory also termed as the primary memory or random access memory. Therefore, a process is termed as an active entity. It disappears if the machine is rebooted. Several process may be associated with a same program. On a multiprocessor system, multiple processes can be executed in parallel. On a uni-processor system, though true parallelism is not achieved, a process scheduling algorithm is applied and the processor is scheduled to execute each process one at a time yielding an illusion of concurrency. Example: Executing multiple instances of the ‘Calculator’ program. Each of the instances are termed as a process. Thread: A thread is a subset of the process. It is termed as a ‘lightweight process’, since it is similar to a real process but executes within the context of a process and shares the same resources allotted to the process by the kernel. Usually, a process has only one thread of control – one set of machine instructions executing at a time. A process may also be made up of multiple threads of execution that execute instructions concurrently. Multiple threads of control can exploit the true parallelism possible on multiprocessor systems. On a uni-processor system, a thread scheduling algorithm is applied and the processor is scheduled to run each thread one at a time. All the threads running within a process share...

Words: 292 - Pages: 2

Free Essay

Scheduling

...2.5 SCHEDULING When a computer is multiprogrammed, it frequently has multiple processes competing for the CPU at the same time. This situation occurs whenever two or more processes are simultaneously in the ready state. If only one CPU is available, a choice has to be made which process to run next. The part of the operating system that makes the choice is called the scheduler and the algorithm it uses is called the scheduling algorithm. These topics form the subject matter of the following sections. Many of the same issues that apply to process scheduling also apply to thread scheduling, although some are different. Initially we will focus on process scheduling. Later on we will explicitly look at thread scheduling. 2.5.1 Introduction to Scheduling Back in the old days of batch systems with input in the form of card images on a magnetic tape, the scheduling algorithm was simple: just run the next job on the tape. With timesharing systems, the scheduling algorithm became more complex because there were generally multiple users waiting for service. Some mainframes still combine batch and timesharing service, requiring the scheduler to decide whether a batch job or an interactive user at a terminal should go next. (As an aside, a batch job may be a request to run multiple programs in succession, but for this section, we will just assume it is a request to run a single program.) Because CPU time is a scarce resource on these machines, a good scheduler can make a big difference in...

Words: 8932 - Pages: 36

Premium Essay

Gold Thread Lifting

...time. Aging is a natural process, and in time, the skin's connective tissue begins to thin and the collagen in the skin begin to break down, causing the skin to lose its elasticity. On average, those who are 30 plus years old experience wrinkles, sagging, folds, and deep creases in the face and neck regions. Thanks to developments in cosmetic procedures, the effects of aging can be stalled and unwanted features can even be reversed. Of the various procedures available that claim to restore and renew sagging skin in the facial region, the gold thread lift procedure is one that has provided very positive results. Thread lifting is nothing new in the realm of cosmetic procedures as it has been around since the 1970s, but gold thread lifting has some differences. Thread lifting, in general, is performed to create an artificial matrix underneath the surface of the skin. Multiple threads of stitch-like material are inserted beneath facial tissue. The goal of this process is to raise the mid-face, brow, and neck areas. Gold thread lifting involves a gold thread and a gold-polyglycol acid thread being woven into the skin and its deep, soft tissues. This weaving is done by creating very tiny incisions (1.5 mm) in the hairline, and then passing the threads under the skin in specific locations with the use of a small needle. Introducing this foreign material into the skin prompts the body to produce new collagen and fibroblasts around the threads, thereby tightening underlying...

Words: 820 - Pages: 4

Free Essay

Pos355

...Management, Process Management, File Management, Security Jose Rodriguez POS/355 July 25, 2015 Yevgeniy Tovshteyn Windows Memory Management The Widows 32-bit OS adds a virtual memory system, which is based on a flat 32-bit address space. The 32-bits of address space converts into the 4GB of virtual memory. The 4GB is the amount that can be accessed by a process. The Windows operating system has Kernel-mode and User-mode memory ("Memory Management 101", 2007). If you exceed the memory limit you will get an "out of virtual memory" error and this would show even though you have a lot of physical memory. The Kernel space is the system space portion of the address space in the OS and kernel-mode drivers reside. This is where only the kernel-mode can access this space. The User-mode can only access data that is within their own process ("Need More Memory? Getting Started With Windows Memory Management", n.d.). This means that the User-mode threads cannot have access to data from another process space directly and it's not able to access the system space directly. The interesting thing about the kernel-mode drivers is that they are trusted by the OS and is able to access both the kernel and user space ("Memory Management 101", 2007). Windows Process Management In process management each process provides a measure to execute a program. The process management has an independent virtual address space that contains both data and code that are protected. Each process contains one...

Words: 803 - Pages: 4

Free Essay

Discussion

...ThreadTest implements Runnable { int tickets = 40; ReentrantLock lock = new ReentrantLock(); public void run() { while (true) { lock.lock(); try { if (tickets > 0) { System.out.println(Thread.currentThread().getName() + "is selling NO."+ tickets + " ticket."); --tickets; } lock.unlock(); } catch (Exception e) { lock.unlock(); } } } }     public class Demo1 { public static void main(String[] args) { ThreadTest tt = new ThreadTest(); Thread t1 = new Thread(tt); Thread t2 = new Thread(tt); Thread t3 = new Thread(tt); Thread t4 = new Thread(tt); t1.start(); t2.start(); t3.start(); t4.start(); } } result: Thread-0is Thread-0is Thread-0is Thread-0is Thread-0is Thread-0is Thread-0is Thread-0is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is Thread-3is   selling selling selling selling selling selling selling selling selling selling selling selling selling selling selling selling selling selling selling selling selling selling selling selling selling selling selling selling selling selling selling selling selling selling selling selling selling selling selling selling NO.40 ticket. NO.39 ticket. NO.38 ticket. NO.37 ticket. NO.36 ticket. NO.35 ticket. NO.34 ticket. NO.33 ticket...

Words: 613 - Pages: 3

Free Essay

Test

...Contents At a Glance I Advanced UNIX Programming with Linux Advanced Linux Programming 1 Getting Started 3 2 Writing Good GNU/Linux Software 17 3 Processes 45 4 Threads 61 5 Interprocess Communication 95 II Mastering Linux 6 Devices 129 7 The /proc File System 147 8 Linux System Calls 167 9 Inline Assembly Code 189 10 Security 197 11 A Sample GNU/Linux Application 219 III Appendixes A Other Development Tools 259 B Low-Level I/O 281 C Table of Signals 301 D Online Resources 303 E Open Publication License Version 1.0 305 F GNU General Public License 309 Advanced Linux Programming Mark Mitchell, Jeffrey Oldham, and Alex Samuel www.newriders.com 201 West 103rd Street, Indianapolis, Indiana 46290 An Imprint of Pearson Education Boston • Indianapolis • London • Munich • New York • San Francisco Advanced Linux Programming Copyright © 2001 by New Riders Publishing FIRST EDITION: June, 2001 All rights reserved. No part of this book may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage and retrieval system, without written permission from the publisher, except for the inclusion of brief quotations in a review. International Standard Book Number: 0-7357-1043-0 Library of Congress Catalog Card Number: 00-105343 05 04 03 02 01 7 6 5 4 3 2 1 Interpretation of the printing code:The rightmost doubledigit number is the year of the book’s printing; the rightmost single-digit...

Words: 80064 - Pages: 321

Free Essay

Process Management

...PROCESS MANAGEMENT b.1) Multitasking is when there is two or more programs running at the same time and both are working. The processor will allocate some resources to each program. The processor switching back and forth between tasks so quickly that might look like the processor doing the two things at once. It is also means performing more than one process on a single CPU. Multiple processes are queued and wait for their turn to be executed on CPU, but it appears as if they are running in parallel. Each process provides the resources needed to execute a program and at least one thread of execution. A thread is entity within a process that can be scheduled for execution. Windows are supporting preemptive multitasking which creates the effect of simultaneous execution of multiple threads from multiple processes. To allow groups of processes to be managed as a unit, the job object is being used. The job objects are namable, securable, sharable objects that control attributes of the processes associated with them. A multithreaded process can manage mutually exclusive tasks with threads, such as providing a user interface and performing background calculations. Creating a multithreaded process can also be a convenient way to structure a program that performs several similar or identical tasks concurrently. For example, a named pipe server can create a thread for each client process that attaches to the pipe. This thread manages the communication between the server and the client...

Words: 657 - Pages: 3