Free Essay

How Multithreading Works in a Server

In:

Submitted By stever
Words 853
Pages 4
| CSC 302- Principles of Operating Systems | Assignment on Multithreading | | | Stephen Nyabuti – 12S01ABT023 |

Feb 2013 |

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 that have multiple CPU’s with multiple cores. * A multithreaded application remains responsive to input. This makes it possible for the application to remain responsive to user input while executing tasks. * Superior application responsiveness. If a request can be shown on its own thread applications do not freeze. Another application will not wait pending the completion of another request. * They use a cooperative approach to sharing the CPU which is a drawback. * Blocking system calls are problematic since one blocked thread will block all threads. * In cooperative multithreading the thread themselves are relied to relinquish control once they stop. This creates problems when threads are waiting for resources to become available. * In preemptive multithreading, a system may make a context switch at an inappropriate time causing priority inversion or other negative effects.
As Kernel space threads * No runtime system in each process * The Kernel can easily reschedule threads when they block. * Improved throughput - many concurrent computed operations and I/O requests within a single process. * Simultaneous and fully symmetric use of multiple processors for computation and I/O. * Improved server responsiveness. Large or complex requests or slow clients do not block other requests for service. The overall throughput of the server is much better. * Minimized system resource usage. Threads impose minimal impact on system resources. They require less overhead to create manage and maintain compared to a traditional process. * Thread synchronization functions can be used to provide enhanced process- to - process communication. * The system may make a context switch at an inappropriate time causing priority inversion or other negative effects. This is a drawback. * Another disadvantage in kernel space multithreading is slower thread switching compared to user space threads. * Thread scheduling is also slower than in user space threads. * They get blocked if all of their associated kernel threads get blocked even if there are some user threads that are ready to run.

3. Challenges brought about by multithreading and how they can be overcome.
Thread share data structures and this may bring about challenges when one thread closes a file while another one is still reading from it, or double memory allocation when one thread starts allocating itself more memory and in the process of execution, another thread also notices that there is little memory and also allocates memory. This problem is solved by thread synchronization.
Parent and Child processes in multithreading also face some problems. For example, when a parent process has multiple threads, the child process also has the same for the process to function properly. This creates a challenge for instance when a thread in the parent process is blocked. It will result in the two processes being blocked. To resolve this problem, threads of the parent processes are implemented separate from those of the child processes.
Deadlock is another challenge brought about by multithreading. A Deadlock occurs when each thread is waiting for the other to do something. This problem is solved by the Component Object Model (COM). The COM call control helps in preventing deadlocks.
Multithreading may lead to race condition. This is when one thread finishes before another on which it depends, causing the former to use an unutilized value since the latter has not supplied one. COM supplies some functions specifically designed to help avoid race conditions.

REFERENCES
Multithreading. Retrieved February 19, 2013, from http://www.webopedia.com/TERM/M/ multithreading.html
Stalling, W. (2008). Operating Systems. 6th Edition.
Randon James.(1998) Software and hardware management (4th ed.) U.S.A; McGraw Hill.
Kernel Space. Retrieved February 20, 2013, from www.linfo.org/kernel_space.html
Multithreading Problems. Retrieved February 20,2013, from http://www.roguewave.com/portals/0/products/threadspotter/docs/2011.2/manual_html_linux/manual_html/multithreading_problems.html

Similar Documents

Free Essay

Growth Pattern of Outsourcing

...You are to enter all answers or Prtscrn requirements into this Word Document. You are not permitted to submit any other document format, e.g., Wordpad, PDFs, etc. that is not based on this original Word document. This document contains hidden internal markers and applications that will track the version of this assignment and your assignment progress. You MUST submit the assignments using the Word document(s) provided you. You may not use any other word processor, except Microsoft Word. Do not use Open Office DOCX files. When an instructor has possession of an electronic document it is very easy to detect plagiarism. Many instructors use Turnitin assignments, which is applicable to assignments that permit cut-and-paste as this assignment. It is very easy to compare multiple copies of word documents (see link below). Microsoft provides a variety of FREE anti-plagiarizing tools. And there is a wide variety of tools that can analyze hidden information within a Word document (see sample link below). Changing fonts, margins and spacing does not do it anymore. Even when individuals try to artificially change content, a Word document contains hidden markers that may provide an audit trail to find previous authors and computer systems who have edited the document. Comparing and merging Microsoft Word documents - http://support.microsoft.com/kb/306484 Compare documents side by side - http://office.microsoft.com/en-us/word-help/compare-documents-side-by-side-HA010102251...

Words: 6416 - Pages: 26

Premium Essay

Term Paper

...................................................................................................................... 2 How to start PoSHServer? ....................................................................................................................... 5 How to run PoSHServer jobs with different user credentials?.............................................................. 11 How to set default document?.............................................................................................................. 12 How to change log schedule?................................................................................................................ 12 How to enable basic authentication?.................................................................................................... 13 How to enable windows authentication? ............................................................................................. 15 How to enable directory browsing? ...................................................................................................... 15 How to enable IP restriction? ................................................................................................................ 16 How to enable content filtering? .......................................................................................................... 17 How to enable PHP support? ..................................................................................................

Words: 3517 - Pages: 15

Free Essay

Deadlock Detector and Solver Research Paper

...Deadlock Detector and Solver Abstract Deadlock is one of the most serious and complex problems concerning the reliability of concurrent Java Programs. This paper presents Deadlock Detector and Solver which detects and resolves circular deadlocks of a java program. An agent written in C++ runs parallel to Java Program and monitors the Java Virtual Machine for deadlocks. If the deadlock is detected, the solver agent is used to resolve the deadlock . Introduction The onset of multicore processors forces the programmers to use multiple threads in order to take advantage of hardware parallelism. Java is one of the first languages to make multithreading available to developers. Along with advantages of concurrent systems and multithreading, there are some challenges involved. Java has inter-process communication model which means it has set of methods for exchange of data among multiple threads and processes. It is based on shared data structures and meshes well with hardware architectures in which multiple cores share memory. However Java is susceptible to deadlocks. Deadlock is a condition under which the entire program is halted as each thread in a set attempts to acquire a lock already held by another thread in a set. Java is susceptible to deadlocks because (a) threads exchanges information by sharing variables that they lock with mutex locks and (b) the locking mechanism interacts with other language features, such as aliasing. Consider a simple banking transaction example...

Words: 3641 - Pages: 15

Premium Essay

Cyber Law

...Cyberspace UNIT 2 Structure 2.1 2.2 2.3 2.4 2.5 Introduction Objectives COMPUTER HARDWARE, SOFTWARE AND PACKAGES Evolution and Development of Computing Hardware Components of Computers What is Software? 2.5.1 Difference between System Software and Application Software 2.6 System Software: Functional Categories 2.6.1 2.6.2 System Control Programs System Support Programs 2.7 2.8 2.9 Software Crisis Application Software or Packages Summary 2.10 Terminal Questions 2.11 Answers and Hints 2.12 References and Suggested Readings 2.1 INTRODUCTION Modern computers are equipped with powerful hardware facilities driven by extensive software packages. Today computing speed is very high and it is capable of doing huge amount of work within seconds with proper accuracy. Nowadays computing and telecommunication both controls the whole universe with multiple manners. To access the state of art of computing, it is always better to review the historical milestones in the developments of computers. Nowadays the computer system plays such a vital role that no corporate or individual can survive without it by any means. Starting from the country’s national security to any common issue, the use of the computer system is enormous. In general, the computer accepts inputs, then processes it, and gives the output. 2.2 OBJECTIVES After studying this unit, you will be able to: • • • 18 describe the evolution and development of computing; list hardware components of a computer;...

Words: 4670 - Pages: 19

Premium Essay

Java Programming Language Sl-275

...Sun Educational Services Java Programming Language SL-275 Sun Educational Services Java Programming Language September 1999 Copyright 1999 Sun Microsystems, Inc., 901 San Antonio Road, Palo Alto, California 94303, U.S.A. All rights reserved. This product or document is protected by copyright and distributed under licenses restricting its use, copying, distribution, and decompilation. No part of this product or document may be reproduced in any form by any means without prior written authorization of Sun and its licensors, if any. Third-party software, including font technology, is copyrighted and licensed from Sun suppliers. Parts of the product may be derived from Berkeley BSD systems, licensed from the University of California. UNIX is a registered trademark in the U.S. and other countries, exclusively licensed through X/Open Company, Ltd. Sun, Sun Microsystems, the Sun Logo, Solstice, Java, JavaBeans, JDK, and Solaris are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. in the U.S. and other countries. Products bearing SPARC trademarks are based upon an architecture developed by Sun Microsystems, Inc. The OPEN LOOK and Sun Graphical User Interface was developed by Sun Microsystems, Inc. for its users and licensees. Sun acknowledges the pioneering efforts of Xerox in researching and developing the...

Words: 6064 - Pages: 25

Premium Essay

Operating Systems

...1. List and explain how operating system are classified (25) 2. Give a brief discussion on the structures of an operating system, monolithic and layered (25) (1).List and explain how operating system are classified (25) The operating system is the most important program that runs on a computer. Every general-purpose computer must have an operating system to run other programs. Operating systems perform basic tasks, such as: * recognizing input from the keyboard, * sending output to the display screen, * keeping track of files and directories on the disk, and * Controlling peripheral devices such as disk drives and printers. Operating systems can be classified as follows: Multi-user : Multi-user allows two or more users to run programs at the same time. Some operating systems permit hundreds or even thousands of concurrent users. This type of operating systems allows multiple users to use the system resources simultaneously. A multi-user operating system allows multiple users to access a computer system concurrently. Time-sharing systems can be classified as multi-user systems as they enable multiple-user access to a computer through the sharing of time. : Windows vista, Mac X tiger etc. Single-user: Single-user operating systems, as opposed to multi-user operating systems, are usable by a single user at a time. Being able to use multiple accounts on a Windows operating system does not make...

Words: 1701 - Pages: 7

Free Essay

Project Management for the Central Goverment

...(For Six Months Industrial Training) By Nitika Sharma CHAPTER NO. TITLE PAGE NO. TITLE PAGE…………………………………………………………………………………….i ABSTRACT……………………………………………………………………………………..ii ACKNOWLEDGEMENT………………………………………………………………….iii LIST OF TABLES & FIGURES…………………………………………………………iv 1. INTRODUCTION 1.1 Types of Peer to Peer………………………………………………………………..…...........2 1.1.1 Unstructured P2P…………………………………………………………………………2 1.1.2 Centralized P2P…………………………………………………………………………….3 1.2 Applications………………………………………………………………………..……………….....3 1.3 Advantages…………………..……………………………………………...............................3 1.4 Objective …………………………………………………………………………………………..…....4 1.5 Scope…………………….……………………………………………………………………….………….4 2. FEATURES OF PROJECT…………………………………………………………………………….5 3. HARDWARE & SOFTWARE REQUIREMENTS 3.1 Input Requirements…………………………………….……………………………………..8 3.2 Output Requirements………………………………………………………………………..8 3 3.3 Software Requirements…………………….………………………………………………..8 3.4 Hardware Requirements……………………………………………………………………..8 4. TOOL USED FOR DEVELOPMENT 4.1 NetBeans…………………………………………………………………………….……………….10 4.1.1 Features and Tools…………………..……………………………..………..…….10 4.1.2 Source Code Editor………………………………………………………………….10 4.1.3 GUI Builder………………………………………………………………………………..11 5. TECHNOLOGY TO BE USED 5.1 Introduction to Java…………………………………………………………..……………..13 5.1.1 Java Virtual Machine……………………………………………….…………..13 5.1.2 Principles………………………………………………………………………………..13 5.1.3 Versions………………………………………...

Words: 12882 - Pages: 52

Free Essay

Computer

...Dynamic Computation Migration in Distributed Shared Memory Systems by Wilson Cheng-Yi Hsieh S.B., Massachusetts Institute of Technology (1988) S.M., Massachusetts Institute of Technology (1988) Submitted to the Department of Electrical Engineering and Computer Science in partial fulfillment of the requirements for the degree of Doctor of Philosophy in Computer Science at the MASSACHUSETTS INSTITUTE OF TECHNOLOGY September 1995 c Massachusetts Institute of Technology 1995. All rights reserved. Author : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Department of Electrical Engineering and Computer Science September 5, 1995 Certified by : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : M. Frans Kaashoek Assistant Professor of Computer Science and Engineering Thesis Supervisor Certified by : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : William E. Weihl Associate Professor of Computer Science and Engineering Thesis Supervisor Accepted by : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Frederic R. Morgenthaler Chairman, Departmental Committee on Graduate Students 1 2 Dynamic Computation Migration...

Words: 40765 - Pages: 164

Premium Essay

Operating System

...every basis. Technology has been developing rapidly, compare to the past 20 years. In this new era of technology, computers and laptops have the most critical outcome in our lives. It is changing the way we connect, communicate, share data and interacts. But most importantly, the Operating System has a huge impact on any type of PC and smartphones. According to (Capron, 2001), “An Operating System is the fundamental software that has the access to control all other software and hardware resources” (p. 65). It has control of every file, processes, session of memory and device. (Nickerson, 2001) stated, “The most centralized system software is the OS. Without it, PCs would be extremely hard to utilize.” (p. 31). It is specially designed to work for different types of computers. For example: desktop computer, laptop, tablet PC, handheld PC, etc. Generally, a personal computer (PC) is all-purpose computer. The size and the capabilities make it convenient for individuals, and which is intended to be operated directly by an end user. The different types of operating systems are, Windows, Linux, Mac OS, etc. and each of them have different versions. These advances in hardware and software technologies have increased demands for more advanced and better operating systems. Now, compatible companies such as Windows and Apple are coming up with newer generations in the OS field which performs more complex tasks compare to their previous generations. Operating systems have evolved through...

Words: 1560 - Pages: 7

Premium Essay

Java

...actions. 3. What is the difference between Assignment and Initialization?- Assignment can be done as many times as desired whereas initialization can be done only once. 4. What is OOPs?- Object oriented programming organizes a program around its data, i. e. , objects and a set of well defined interfaces to that data. An object-oriented program can be characterized as data controlling 5. access to code. What are Class, Constructor and Primitive data types?- Class is a template for multiple objects with similar features and it is a blue print for objects. It defines a type of object according to the data the object can hold and the operations the object can perform. Constructor is a special kind of method that determines how an object is initialized when created. Primitive data types are 8 types and they are: byte,...

Words: 6762 - Pages: 28

Premium Essay

Assigement

...system. c) To change password for the current user. d) To move the directory /usr/local to /opt/pgms. e) To list various files and directories in current working directory. Ans:- a) Make your Home Directory your current directory. Use the 'cd' command without any target; that always puts you in the home directory which becomes by default the working directory. b) To display who is logged in your system. who command is used to get the list of the usernames who are currently logged in. Output of the who command contains the following columns: user name, tty number, date and time, machine address. $ who ramesh pts/0 2009-03-28 22:57 (dev-db-server) jason pts/1 2009-03-28 23:01 (dev-db-server) john pts/2 2009-03-28 23:04 (dev-db-server)   To get a list of all usernames that are currently logged in, use the following: $ who | cut -d' ' -f1 | sort | uniq john jason ramesh c) To change password for the current user. Almost all Linux and Unix and variants have access to the passwd command. Enter this command at the prompt to change your password. You'll need to know the current password before being able to change the password to a new password. c) To move the directory /usr/local to /opt/pgms. To move SOURCE directory to a DEST directory use the mv command as follows:   mv source dest mv/usr/local /opt/pgms d) To list various...

Words: 2650 - Pages: 11

Premium Essay

Assigement

...system. c) To change password for the current user. d) To move the directory /usr/local to /opt/pgms. e) To list various files and directories in current working directory. Ans:- a) Make your Home Directory your current directory. Use the 'cd' command without any target; that always puts you in the home directory which becomes by default the working directory. b) To display who is logged in your system. who command is used to get the list of the usernames who are currently logged in. Output of the who command contains the following columns: user name, tty number, date and time, machine address. $ who ramesh pts/0 2009-03-28 22:57 (dev-db-server) jason pts/1 2009-03-28 23:01 (dev-db-server) john pts/2 2009-03-28 23:04 (dev-db-server)   To get a list of all usernames that are currently logged in, use the following: $ who | cut -d' ' -f1 | sort | uniq john jason ramesh c) To change password for the current user. Almost all Linux and Unix and variants have access to the passwd command. Enter this command at the prompt to change your password. You'll need to know the current password before being able to change the password to a new password. c) To move the directory /usr/local to /opt/pgms. To move SOURCE directory to a DEST directory use the mv command as follows:   mv source dest mv/usr/local /opt/pgms d) To list various...

Words: 2650 - Pages: 11

Free Essay

Unix, Linux, Mac Os, Windows Os Comparison

...Introduction The most commonly known Operating Systems (OS) today are UNIX, Linux, MacOS, and Windows. These operating systems all behave in their own way and similar in others. This paper will discuss this comparison of how these operating systems utilize memory, process handling, file management, and security. Memory Management Each operating system is required to allocate a certain amount of memory for the operating system itself for the processes that are being used or executed. There are two places memory exists: physically on the motherboard of the computer and within the operating system itself. When the operating system dynamically divides the memory usage between these two areas, this is called memory management. Each operating system manages memory different from the others; however they all follow some basic rules of memory management. All of the operating system’s memory management in general follows these requirements: relocation, protection, sharing, logical organization, and physical organization (Stallings, 2015). Relocation of memory is the process that allows the operating system to move a process or file from physical memory to virtual memory and back again, depending on the need for that data. Virtual memory exists within the operating system which uses the hard drive to store temporary information and physical memory is located on the motherboard of the computer. While the process is in memory, protection of that area needs to be enabled to...

Words: 2918 - Pages: 12

Free Essay

With the Development of Technology, More and More Robots Are Used in Various Fields,

...and Enterprise Integration Technologies Software Engineering Data Base Technologies Programming for Mobile and Remote Computers Information Technology for Management of Enterprise TOTAL Week 4 Scheme of Examinations Theory T/W Practical Oral Total Hours Marks Marks Marks Marks Marks 3 100 25 -25 150 Pract/ Week 2 Tut/ Week -- 2 4 2 -- 3 100 25 -- 25 150 3 4 5 4 4 4 2 2 2 ---- 3 3 3 100 100 100 25 25 25 --25 25 25 -- 150 150 150 6 4 24 10 1 1 3 -- 100 600 25 150 -25 25 125 150 900 INFORMATION AND NETWORK SECURITY CLASS T.E. ( INFORMATION TECHNOLOGY) HOURS PER LECTURES : WEEK TUTORIALS : PRACTICALS EVALUATION SYSTEM: THEORY PRACTICAL ORAL TERM WORK : SEMESTER VI 04 -02 HOURS 3 ---- MARKS 100 25 25 1. Introduction What is Information Security? Security Goals. 2. Cryptography Crypto Basic, Classic Cryptography, Symmetric Key Cryptography: Stream Ciphers, A5/1, RC4, Block Ciphers, Feistel Cipher, DES, Triple DES, AES, Public Key Cryptography: Kanpsack, RSA, Defiie-Hellman, use of public key crypto- Signature and Non-repudiation, Confidentiality and Non-repudiation, Public Key Infrastructure, Hash Function: The Birthday Problem, MD5, SHA-1, Tiger Hash, Use of Hash Function. 3. Access control - Authentication and Authorization Authentication Methods, Passwords, Biometric, Single – sign on, Authentication Protocol, Kerberos, Access control Matrix, ACLs, Multiple level security model...

Words: 3868 - Pages: 16

Free Essay

Case Study

...CS (SDE) 2007-08 with MQP Page 1 of 16 Annexure No. SCAA Dated BHARATHIAR UNIVERSITY, COIMBATORE – 641 046 M. Sc COMPUTER SCIENCE For School of Distance Education (Effective from the academic Year 2007-2008) Scheme of Examinations 31 J 29.02.2008 Year Subject and Paper I Paper I Paper II Paper III Paper IV Practical I Paper V Paper VI Paper VII Practical II Project Advanced Computer Architecture Computer Graphics & Multimedia Software Engineering Computer Networks Computer Graphics and Multimedia Lab Advanced Operating System Internet programming and Web Design Data Mining and Warehousing Internet programming and Web Design Lab Project Work and Viva Voce Total University Examinations Durations Max in Hrs Marks 3 100 3 100 3 100 3 100 3 100 3 3 3 3 100 100 100 100 100 1000 II For project work and viva voce (External) Breakup: Project Evaluation : 75 Viva Voce : 25 1 Anx.31 J - M Sc CS (SDE) 2007-08 with MQP Page 2 of 16 YEAR – I PAPER I: ADVANCED COMPUTER ARCHITECTURE Subject Description: This paper presents the concept of parallel processing, solving problem in parallel processing, Parallel algorithms and different types of processors. Goal: To enable the students to learn the Architecture of the Computer. Objectives: On successful completion of the course the students should have: Understand the concept of Parallel Processing. Learnt the different types of Processors. Learnt the Parallel algorithms. Content: Unit I Introduction to parallel...

Words: 3613 - Pages: 15