This chapter discusses multithreaded programming and threads. It defines a thread as the basic unit of CPU utilization that allows multiple tasks to run concurrently within a process by sharing the process's resources. Different threading models like many-to-one, one-to-one, and many-to-many are described based on how user threads map to kernel threads. Common thread libraries for POSIX, Windows, and Java are also covered. The chapter examines issues in multithreaded programming and provides examples of how threads are implemented in Windows and Linux.
The Deadlock Problem
System Model
Deadlock Characterization
Methods for Handling Deadlocks
Deadlock Prevention
Deadlock Avoidance
Deadlock Detection
Recovery from Deadlock
The Deadlock Problem
System Model
Deadlock Characterization
Methods for Handling Deadlocks
Deadlock Prevention
Deadlock Avoidance
Deadlock Detection
Recovery from Deadlock
In this presentation, I am explaining about Threads, types of threads, its advantages and disadvantages, difference between Process and Threads, multithreading and its type.
"Like the ppt if you liked the ppt"
LinkedIn - https://in.linkedin.com/in/prakharmaurya
UNIT II PROCESS MANAGEMENT
Processes-Process Concept, Process Scheduling, Operations on Processes, Interprocess Communication; Threads- Overview, Multicore Programming, Multithreading Models; Windows 7 - Thread and SMP Management. Process Synchronization - Critical Section Problem, Mutex Locks, Semophores, Monitors; CPU Scheduling and Deadlocks.
Virtual Memory
• Copy-on-Write
• Page Replacement
• Allocation of Frames
• Thrashing
• Operating-System Examples
Background
Page Table When Some PagesAre Not in Main Memory
Steps in Handling a Page Fault
In this presentation, I am explaining about Threads, types of threads, its advantages and disadvantages, difference between Process and Threads, multithreading and its type.
"Like the ppt if you liked the ppt"
LinkedIn - https://in.linkedin.com/in/prakharmaurya
UNIT II PROCESS MANAGEMENT
Processes-Process Concept, Process Scheduling, Operations on Processes, Interprocess Communication; Threads- Overview, Multicore Programming, Multithreading Models; Windows 7 - Thread and SMP Management. Process Synchronization - Critical Section Problem, Mutex Locks, Semophores, Monitors; CPU Scheduling and Deadlocks.
Virtual Memory
• Copy-on-Write
• Page Replacement
• Allocation of Frames
• Thrashing
• Operating-System Examples
Background
Page Table When Some PagesAre Not in Main Memory
Steps in Handling a Page Fault
SoftCloud: A Tool for Visualizing Software Artifacts as Tag Clouds.pdfRa'Fat Al-Msie'deen
Software artifacts visualization helps software developers to manage the size and complexity of the software system. The tag cloud technique visualizes tags within the cloud according to their frequencies in software artifacts. A font size of the tag within the cloud indicates its frequency within a software artifact, while the color of a tag within the cloud uses just for aesthetic purposes. This paper suggests a new approach (SoftCloud) to visualize software artifacts as a tag cloud. The originality of SoftCloud is visualizing all the artifacts available to the software program as a tag cloud. Experiments have conducted on different software artifacts to validate SoftCloud and demonstrate its strengths. The results showed the ability of SoftCloud to correctly retrieve all tags and their frequencies from available software artifacts.
BushraDBR: An Automatic Approach to Retrieving Duplicate Bug Reports.pdfRa'Fat Al-Msie'deen
A Bug Tracking System (BTS), such as Bugzilla, is generally utilized to track submitted Bug Reports (BRs) for a particular software system. Duplicate Bug Report (DBR) retrieval is the process of obtaining a DBR in the BTS. This process is important to avoid needless work from engineers on DBRs. To prevent wasting engineer resources, such as effort and time, on previously submitted (or duplicate) BRs, it is essential to find and retrieve DBRs as soon as they are submitted by software users. Thus, this paper proposes an automatic approach (called BushraDBR) that aims to assist an engineer (called a triager) to retrieve DBRs and stop the duplicates before they start. Where BushraDBR stands for Bushra Duplicate Bug Reports retrieval process. Therefore, when a new BR is sent to the Bug Repository (BRE), an engineer checks whether it is a duplicate of an existing BR in BRE or not via BushraDBR approach. If it is, the engineer marks it as DBR, and the BR is excluded from consideration for any additional work; otherwise, the BR is added to the BRE. BushraDBR approach relies on Textual Similarity (TS) between the newly submitted BR and the rest of the BRs in BRE to retrieve DBRs. BushraDBR exploits unstructured data from BRs to apply Information Retrieval (IR) methods in an efficient way. BushraDBR approach uses two techniques to retrieve DBRs: Latent Semantic Indexing (LSI) and Formal Concept Analysis (FCA). The originality of BushraDBR is to stop DBRs before they occur by comparing the newly reported BR with the rest of the BRs in the BTS, thus saving time and effort during the Software Maintenance (SM) process. BushraDBR also uniquely retrieves DBR through the use of LSI and FCA techniques. BushraDBR approach had been validated and evaluated on several publicly available data sets from Bugzilla. Experiments show the ability of BushraDBR approach to retrieve DBRs in an efficient and accurate manner.
Software evolution understanding: Automatic extraction of software identifier...Ra'Fat Al-Msie'deen
Software companies usually develop a set of product variants within the same family that share certain functions and differ in others. Variations across software variants occur to meet different customer requirements. Thus, software product variants evolve overtime to cope with new requirements. A software engineer who deals with this family may find it difficult to understand the evolution scenarios that have taken place over time. In addition, software identifier names are important resources to understand the evolution scenarios in this family. This paper introduces an automatic approach called Juana’s approach to detect the evolution scenario across two product variants at the source code level and identifies the common and unique software identifier names across software variants source code. Juana’s approach refers to common and unique identifier names as a software identifiers map and computes it by comparing software variants to each other. Juana considers all software identifier names such as package, class, attribute, and method. The novelty of this approach is that it exploits common and unique identifier names across the source code of software variants, to understand the evolution scenarios across software family in an efficient way. For validity, Juana was applied on ArgoUML and Mobile Media software variants. The results of this evaluation validate the relevance and the performance of the approach as all evolution scenarios were correctly detected via a software identifiers map.
BushraDBR: An Automatic Approach to Retrieving Duplicate Bug ReportsRa'Fat Al-Msie'deen
A Bug Tracking System (BTS), such as Bugzilla, is generally utilized to track submitted Bug Reports (BRs) for a particular software system. Duplicate Bug Report (DBR) retrieval is the process of obtaining a DBR in the BTS. This process is important to avoid needless work from engineers on DBRs. To prevent wasting engineer resources, such as effort and time, on previously submitted (or duplicate) BRs, it is essential to find and retrieve DBRs as soon as they are submitted by software users. Thus, this paper proposes an automatic approach (called BushraDBR) that aims to assist an engineer (called a triager) to retrieve DBRs and stop the duplicates before they start. Where BushraDBR stands for Bushra Duplicate Bug Reports retrieval process. Therefore, when a new BR is sent to the Bug Repository (BRE), an engineer checks whether it is a duplicate of an existing BR in BRE or not via BushraDBR approach. If it is, the engineer marks it as DBR, and the BR is excluded from consideration for any additional work; otherwise, the BR is added to the BRE. BushraDBR approach relies on Textual Similarity (TS) between the newly submitted BR and the rest of the BRs in BRE to retrieve DBRs. BushraDBR exploits unstructured data from BRs to apply Information Retrieval (IR) methods in an efficient way. BushraDBR approach uses two techniques to retrieve DBRs: Latent Semantic Indexing (LSI) and Formal Concept Analysis (FCA). The originality of BushraDBR is to stop DBRs before they occur by comparing the newly reported BR with the rest of the BRs in the BTS, thus saving time and effort during the Software Maintenance (SM) process. BushraDBR also uniquely retrieves DBR through the use of LSI and FCA techniques. BushraDBR approach had been validated and evaluated on several publicly available data sets from Bugzilla. Experiments show the ability of BushraDBR approach to retrieve DBRs in an efficient and accurate manner.
Source code summarization is a process of generating summaries that describes software code, the majority of source code summarization usually generated manually, where the summaries are written by software developers. Recently, new automated approaches are becoming more useful. These approaches have been found to be effective in some cases. The main weaknesses of these approaches are that they never exploit code dependencies and summarize either the software classes or methods but not both. This paper proposes a source code summarization approach (Suncode) that produces a short description for each class and method in the software system. To validate the approach, it has been applied on several case studies. Moreover, the generated summaries are compared to summaries that written by human experts and to summaries that written by a state-of-the-art solution. Results of this paper found that Suncode summaries provide better information about code dependencies comparing with other studies. In addition, Suncode summaries can improve and support the current software documentation. The results found that manually written summaries were more precise and short as well.
FeatureClouds: Naming the Identified Feature Implementation Blocks from Softw...Ra'Fat Al-Msie'deen
Identifying software identifiers that implement a particular feature of a software product is known as feature identification. Feature identification is one of the most critical and popular processes performed by software engineers during software maintenance activity. However, a meaningful name must be assigned to the Identified Feature Implementation Block (IFIB) to complete the feature identification process. The feature naming process remains a challenging task, where the majority of existing approaches manually assign the name of the IFIB. In this paper, the approach called FeatureClouds was proposed, which can be exploited by software developers to name the IFIBs from software code. FeatureClouds approach incorporates word clouds visualization technique to name Feature Blocks (FBs) by using the most frequent words across these blocks. FeatureClouds had evaluated by assessing its added benefit to the current approaches in the literature, where limited tool support was supplied to software developers to distinguish feature names of the IFIBs. For validity, FeatureClouds had applied to draw shapes and ArgoUML software. The findings showed that the proposed approach achieved promising results according to well-known metrics in terms of Precision and Recall.
YamenTrace: Requirements Traceability - Recovering and Visualizing Traceabili...Ra'Fat Al-Msie'deen
YamenTrace - Requirements Traceability: Recovering and Visualizing Traceability Links Between Requirements and Source Code of Object-oriented Software Systems (Presentation 2023)
Automatic Labeling of the Object-oriented Source Code: The Lotus ApproachRa'Fat Al-Msie'deen
Most of open-source software systems become available on the internet today. Thus, we need automatic methods to label software code. Software code can be labeled with a set of keywords. These keywords in this paper referred as software labels. The goal of this paper is to provide a quick view of the software code vocabulary. This paper proposes an automatic approach to document the object-oriented software by labeling its code. The approach exploits all software identifiers to label software code. The paper presents the results of study conducted on the ArgoUML and drawing shapes case studies. Results showed that all code labels were correctly identified.
Constructing a software requirements specification and design for electronic ...Ra'Fat Al-Msie'deen
Requirements engineering process intends to obtain software services and constraints. This process is essential to meet the customer's needs and expectations. This process includes three main activities in general. These are detecting requirements by interacting with software stakeholders, transferring these requirements into a standard document, and examining that the requirements really define the software that the client needs. Functional requirements are services that the software should deliver to the end-user. In addition, functional requirements describe how the software should respond to specific inputs, and how the software should behave in certain circumstances. This paper aims to develop a software requirements specification document of the electronic IT news magazine system. The electronic magazine provides users to post and view up-to-date IT news. Still, there is a lack in the literature of comprehensive studies about the construction of the electronic magazine software specification and design in conformance with the contemporary software development processes. Moreover, there is a need for a suitable research framework to support the requirements engineering process. The novelty of this paper is the construction of software specification and design of the electronic magazine by following the Al-Msie'deen research framework. All the documents of software requirements specification and design have been constructed to conform to the agile usage-centered design technique and the proposed research framework. A requirements specification and design are suggested and followed for the construction of the electronic magazine software. This study proved that involving users extensively in the process of software requirements specification and design will lead to the creation of dependable and acceptable software systems.
Detecting commonality and variability in use-case diagram variantsRa'Fat Al-Msie'deen
The use-case diagram is a software artifact. Thus, as with any software artifact, the use-case diagrams change across time through the software development life cycle. Therefore, several versions of the same diagram are existed at distinct times. Thus, comparing all use-case diagram variants to detect common and variable use-cases becomes one of the main challenges in the product line reengineering field. The contribution of this paper is to suggest an automatic approach to compare a collection of use-case diagram variants and detect both commonality and variability. In our work, every use-case represents a feature. The proposed approach visualizes the detected features using formal concept analysis, where common and variable features are introduced to software engineers. The proposed approach was applied on a mobile media case study to be validated. The findings confirm the importance and the performance of the suggested approach as all common and variable features were precisely detected via formal concept analysis and latent semantic indexing.
Naming the Identified Feature Implementation Blocks from Software Source CodeRa'Fat Al-Msie'deen
Identifying software identifiers that implement a particular feature of a software product is known as feature identification. Feature identification is one of the most critical and popular processes performed by software engineers during software maintenance activity. However, a meaningful name must be assigned to the Identified Feature Implementation Block (IFIB) to complete the feature identification process. The feature naming process remains a challenging task, where the majority of existing approaches manually assign the name of the IFIB. In this paper, the approach called FeatureClouds was proposed, which can be exploited by software developers to name the IFIBs from software code. FeatureClouds approach incorporates word clouds visualization technique to name Feature Blocks (FBs) by using the most frequent words across these blocks. FeatureClouds had evaluated by assessing its added benefit to the current approaches in the literature, where limited tool support was supplied to software developers to distinguish feature names of the IFIBs. For validity, FeatureClouds had applied to draw shapes and ArgoUML software. The findings showed that the proposed approach achieved promising results according to well-known metrics in terms of Precision and Recall.
This slide is special for master students (MIBS & MIFB) in UUM. Also useful for readers who are interested in the topic of contemporary Islamic banking.
A workshop hosted by the South African Journal of Science aimed at postgraduate students and early career researchers with little or no experience in writing and publishing journal articles.
The simplified electron and muon model, Oscillating Spacetime: The Foundation...RitikBhardwaj56
Discover the Simplified Electron and Muon Model: A New Wave-Based Approach to Understanding Particles delves into a groundbreaking theory that presents electrons and muons as rotating soliton waves within oscillating spacetime. Geared towards students, researchers, and science buffs, this book breaks down complex ideas into simple explanations. It covers topics such as electron waves, temporal dynamics, and the implications of this model on particle physics. With clear illustrations and easy-to-follow explanations, readers will gain a new outlook on the universe's fundamental nature.
Executive Directors Chat Leveraging AI for Diversity, Equity, and InclusionTechSoup
Let’s explore the intersection of technology and equity in the final session of our DEI series. Discover how AI tools, like ChatGPT, can be used to support and enhance your nonprofit's DEI initiatives. Participants will gain insights into practical AI applications and get tips for leveraging technology to advance their DEI goals.
This presentation includes basic of PCOS their pathology and treatment and also Ayurveda correlation of PCOS and Ayurvedic line of treatment mentioned in classics.
Introduction to AI for Nonprofits with Tapp NetworkTechSoup
Dive into the world of AI! Experts Jon Hill and Tareq Monaur will guide you through AI's role in enhancing nonprofit websites and basic marketing strategies, making it easy to understand and apply.
How to Build a Module in Odoo 17 Using the Scaffold MethodCeline George
Odoo provides an option for creating a module by using a single line command. By using this command the user can make a whole structure of a module. It is very easy for a beginner to make a module. There is no need to make each file manually. This slide will show how to create a module using the scaffold method.
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Dr. Vinod Kumar Kanvaria
Exploiting Artificial Intelligence for Empowering Researchers and Faculty,
International FDP on Fundamentals of Research in Social Sciences
at Integral University, Lucknow, 06.06.2024
By Dr. Vinod Kumar Kanvaria
This presentation was provided by Steph Pollock of The American Psychological Association’s Journals Program, and Damita Snow, of The American Society of Civil Engineers (ASCE), for the initial session of NISO's 2024 Training Series "DEIA in the Scholarly Landscape." Session One: 'Setting Expectations: a DEIA Primer,' was held June 6, 2024.
4. 4.4
ObjectivesObjectives
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
5. 4.5
MotivationMotivation
Most modern applications are multithreaded
Threads run within application
Multiple tasks with the application can be implemented by separate
threads
Update display / mouse on screen
Fetch data
Spell checking
Answer a network request
Process creation is heavy-weight while thread creation is light-
weight (less resources)
Can simplify code, increase efficiency
Kernels are generally multithreaded
6. 4.6
Chapter 4: ThreadsChapter 4: Threads
A thread is a basic unit of CPU utilization (use) ,(Lightweight
process: LWP), not stand alone process but a part of it (process).
Each thread has its own ID , stack, program counter, and registers.
Threads share common code, data, and open files.
Each single window under word process is a single thread.
Figure x. Lightweight process (LWP).
9. 4.9
BenefitsBenefits
Responsiveness: Faster execution.
Resource Sharing: By default threads share common code,
data, and other resources, which allows multiple tasks to be
performed simultaneously in a single address space.
threads share resources of process, easier than shared
memory or message passing
Economy :Creating and managing threads ( and context switches
between them ) is much faster than performing the same tasks for
processes.
cheaper than process creation, thread switching lower
overhead than context switching
Utilization of MP Architectures: A single threaded process
can only run on one CPU, whereas the execution of a multi-
threaded application may be split between available processors.
Scalability – process can take advantage of multiprocessor
architectures
10. 4.10
Multicore ProgrammingMulticore Programming
Multicore or multiprocessor systems putting pressure on programmers,
challenges include:
Dividing activities
Balance
Data splitting
Data dependency
Testing and debugging
Parallelism implies a system can perform more than one task simultaneously
Concurrency supports more than one task making progress
Single processor / core, scheduler providing concurrency
Types of parallelism
Data parallelism – distributes subsets of the same data across multiple
cores, same operation on each
Task parallelism – distributing threads across cores, each thread
performing unique operation
12. 4.12
Types of threadsTypes of threads
User threads
Threads that created and managed in the user space , without
kernel support.
User threads - management done by user-level threads library
These are the threads that application programmers put into
their programs.
user-direct to- CPU (execution)
Kernel acts with processes not with threads.
Kernel threads
Kernel threads - Supported by the Kernel
threads are supported (managed, created, killed) by the OS.
Kernel acts with threads.
Examples – virtually all general purpose operating systems,
including: Windows, Solaris, Linux, Tru64 UNIX and Mac OS X.
14. 4.14
Many-to-OneMany-to-One
Many user-level threads mapped to single kernel thread
One thread blocking causes all to block
If a blocking system call is made, then the entire process blocks.
Multiple threads may not run in parallel on Multicore system because only one
may be in kernel at a time
Single kernel thread can operate only on a single CPU, so the many-to-one
model does not allow individual processes to be split across multiple CPUs.
Few systems currently use this model
Examples:
Solaris Green Threads
GNU Portable Threads
Figure x. Many-to-one model.
15. 4.15
One-to-OneOne-to-One
Each user-level thread maps to kernel thread
Creating a user-level thread creates a kernel thread
More concurrency than many-to-one
Number of threads per process sometimes restricted due to
overhead
The overhead of managing the one-to-one model is more
significant, involving more overhead and slowing down the
system.
Examples
Windows NT/XP/2000
Linux
Solaris 9 and later
Figure x. One-to-one model.
16. 4.16
Many-to-Many ModelMany-to-Many Model
Allows many user level threads to be
mapped to many kernel threads
Allows the operating system to create a
sufficient number of kernel threads
Block a specific thread ,unlike many-one
Less overhead, unlike one-one
Solaris prior to version 9
Windows NT/2000 with the ThreadFiber
package
Figure x. Many-to-many model.
17. 4.17
Two-level ModelTwo-level Model
Similar to M:M, except that it allows a user thread to be bound to
kernel thread
A popular variation of the many-to-many model is the two-tier model,
which allows either many-to-many or one-to-one operation.
Examples
IRIX
HP-UX
Tru64 UNIX
Solaris 8 and earlier
Figure x. Two-level model.
18. 4.18
Thread LibrariesThread Libraries
Thread library provides programmer with API for creating and
managing threads
Two primary ways of implementing
Library entirely in user space
Kernel-level library supported by the OS
19. 4.19
PthreadsPthreads
May be provided either as user-level or kernel-level
A POSIX standard (IEEE 1003.1c) API for thread creation and
synchronization
POSIX stands for Portable Operating System Interface for Unix
Specification, not implementation
API specifies behavior of the thread library, implementation is up to
development of the library
Common in UNIX operating systems (Solaris, Linux, Mac OS X)
20. 4.20
Windows ThreadsWindows Threads
The technique for creating threads using the Windows thread
library is similar to the Pthreads technique in several ways.
21. 4.21
Java ThreadsJava Threads
Threads are the fundamental model of program execution in a Java
program, and the Java language and its API provide a rich set of features for
the creation and management of threads.
Java threads are managed by the JVM
Typically implemented using the threads model provided by underlying OS
Java threads may be created by:
Extending Thread class
Implementing the Runnable interface
22. 4.22
Implicit ThreadingImplicit Threading
Growing in popularity as numbers of threads increase, program correctness more
difficult with explicit threads.
Creation and management of threads done by compilers and run-time libraries
rather than programmers.
Three methods explored
Thread Pools –
Create a number of threads in a pool where they await work
OpenMP –
OpenMP is a set of compiler directives as well as an API for programs
written in C, C++, or FORTRAN that provides support for parallel
programming in shared-memory environments.
Grand Central Dispatch –
Apple technology for Mac OS X and iOS operating systems
Extensions to C, C++ languages, API, and run-time library
Allows identification of parallel sections
Other methods include Microsoft Threading Building Blocks (TBB),
java.util.concurrent package
23. 4.23
Thread PoolsThread Pools
Create a number of threads in a pool where they await work.
Advantages: (Thread pools offer these benefits:)
Usually slightly faster to service a request with an existing thread than
create a new thread.
Allows the number of threads in the application(s) to be bound to the
size of the pool.
A sample thread pool (green boxes) with waiting tasks (blue) and completed tasks
(yellow)
25. 4.25
Semantics of fork() and exec()Semantics of fork() and exec()
Does fork() duplicate only the calling thread or all threads?
o Some UNIXes have two versions of fork
There are two options:
Create a child process that contains identical copy of the whole
threads in the parent process.
OR
Create a child process that contains a copy of the thread that
executed the fork call only.
Exec() usually works as normal – replace the running process
including all threads
26. 4.26
Thread CancellationThread Cancellation
Terminating a thread before it has finished
Thread to be canceled is target thread
Two general approaches:
Asynchronous cancellation terminates the target thread
immediately.
Deferred (synchronous) cancellation allows the target
thread to periodically check if it should be cancelled.
Why :
Data consistent , …… updating.
On Linux systems, thread cancellation is handled through signals
Signals are used in UNIX systems to notify a process that a
particular event has occurred.
A signal handler is used to process signals. (See next slide)
27. 4.27
Signal HandlingSignal Handling
Signals are used in UNIX systems to notify a process that a particular event has
occurred
A signal handler is used to process signals
1. Signal is generated by particular event
2. Signal is delivered to a process
3. Signal is handled
Signal is handled by one of two signal handlers:
1. Default signal handler
2. User-defined signal handler
Options:
Deliver the signal to the thread to which the signal applies
Deliver the signal to every thread in the process
Deliver the signal to certain threads in the process
Assign a specific thread to receive all signals for the process
28. 4.28
Thread-Local StorageThread-Local Storage
Thread-local storage (TLS) allows each thread to have its own copy of
data.
Useful when you do not have control over the thread creation process (i.e.,
when using a thread pool).
Different from local variables:
Local variables visible only during single function invocation.
TLS visible across function invocations.
Similar to static data.
TLS is unique to each thread.
29. 4.29
Scheduler ActivationsScheduler Activations
Both M:M and Two-level models require communication to maintain the
appropriate number of kernel threads allocated to the application.
Typically use an intermediate data structure between user and kernel threads –
lightweight process (LWP).
Appears to be a virtual processor on which process can schedule user thread
to run.
Each LWP attached to kernel thread.
How many LWPs to create?
Scheduler activations provide upcalls - a communication mechanism from the
kernel to the upcall handler in the thread library.
This communication allows an application to maintain the correct number kernel
threads
Figure x. Lightweight process (LWP).
30. 4.30
Operating System ExamplesOperating System Examples
Windows XP Threads:
Windows implements the Windows API – primary API for Win 98,
Win NT, Win 2000, Win XP, and Win 7.
Implements the one-to-one mapping, kernel-level
The register set, stacks, and private storage area are known as
the context of the thread
Linux Thread:
Linux refers to them as tasks rather than threads.
Thread creation is done through clone() system call.