Thread System Requirement Specification
CoreLinux++
Functional Requirement Document Revision $Revision: 1.2 $ Last
Modified : Tuesday, March 21, 2000
Title : Thread
1. Introduction
A thread is a single, sequential flow of control within a program.
It is also the smallest unit of execution that Linux schedules. A
thread consists of a stack, the state of the CPU registers, and an
entry in the execution list of the system scheduler. At the
implementors discretion, each thread can share all of the process's
resources (Memory, Files, Signals, etc.).
A process consists of one or more threads, data, and other
resources of a program in memory. A multi-threaded application is
considered when there is at least one thread in addition to the main
thread of the program. A program executes when the system scheduler
gives one of its threads execution control. The scheduler determines
which threads should run and when they should run. Threads of lower
priority may have to wait while higher priority threads complete
their tasks. On multiprocessor machines, the scheduler can move
individual threads to different processors to "balance" the
CPU load, or providing maximum throughput.
Each thread in a process operates independently. Unless you make
them visible to each other, the threads execute individually and are
unaware of the other threads in a process. Collectively, the
resources a thread references (stack, registers, variables,
instructions, etc.) are considered as part of the context for the
path of execution. Threads sharing common resources, however, may
need to coordinate their work by using semaphores or other methods of
interprocess communication.
1.1 Deliverables Overview
Objective
The main deliverable objective is to provide for the overall
management of threads in a user application. This includes supporting
starting the user defined entry point, providing default stack and
stack management, instrumentation, exception management, signal
management, clean-up management, accountability, and necessary thread
safe functions that are not dependent upon system libraries.
2. Functional Requirements
General Requirements
The CoreLinux++ Thread implementation shall provide interface
which supports starting a thread of execution.
The CoreLinux++ Thread implementation shall provide interface
for specifying variable number of arguments to the thread of
execution.
The CoreLinux++ Thread implementation shall provide interface
for specifying a caller defined stack to use.
The CoreLinux++ Thread implementation shall allocate a
default stack for a new thread if one is not specified by the
caller.
The CoreLinux++ Thread implementation shall provide interface
for specifying a default stack allocation size.
The CoreLinux++ Thread implementation shall provide options
for creating default stacks in system memory.
The CoreLinux++ Thread implementation shall manage all
threads created through it's interface
The CoreLinux++ Thread implementation shall create a
ThreadContext for each thread it creates.
The CoreLinux++ Thread implementation shall maintain the
ThreadContext on behalf of the caller.
The CoreLinux++ Thread implementation shall provide the
ThreadContext to the caller upon request.
The CoreLinux++ Thread implementation shall provide a
iterator over all the ThreadContexts created through it's interface.
The CoreLinux++ Thread implementation shall provide
instrumentation information.
The CoreLinux++ Thread implementation instrumentation shall
include the number of threads created count.
The CoreLinux++ Thread implementation instrumentation shall
include the number of threads completed count.
The CoreLinux++ Thread implementation instrumentation shall
include the number of threads active count.
The CoreLinux++ Thread implementation instrumentation shall
include the number of threads blocked count.
The CoreLinux++ Thread implementation shall provide the
interface for setting a threads priority.
The CoreLinux++ Thread implementation shall provide the
interface for getting a threads priority.
The CoreLinux++ Thread implementation shall provide the
interface for sending a signal to a thread.
The CoreLinux++ Thread implementation shall handle all
signals for a thread by default.
The CoreLinux++ Thread implementation shall provide the
interface for setting a threads signal mask.
The CoreLinux++ Thread implementation shall provide the
interface for getting a threads signal mask.
The CoreLinux++ Thread implementation shall provide the
interface for instructing a thread to exit imediatley.
The CoreLinux++ Thread implementation shall provide the
interface for a caller to block until a thread completes execution.
2.1 User Interface Specifications
NA
2.2 Product Services
NA
2.3 External Interfaces and Database Requirements
NA
2.4 Error Handling
2.5 Foreseeable Functional Changes and Enhancements
3. Non-Functional Requirements
3.1 Performance Requirements
3.2 User Documentation and Other User Aids
Use Case, Analysis, Design, and Class Reference documentation.
3.3 Development Requirements
Standards: CoreLinux++ C++ Standards and
Guidelines
3.4 Foreseeable Non-Functional Changes
TBD
4. Remarks and Guidelines for Later Life Cycle Phases
TBD
5. Term Glossary
Copyright © 1999, 2000 by CoreLinux Consortium
This material may be distributed only subject to the terms and conditions set forth in the
Open Publication License
|