Segement-New Microprocessors
Segement-New Microprocessors
microprocessors
Sazid Zaman Khan
Processes
A process has a self-contained execution
environment. A process generally has a complete,
private set of basic run-time resources; in
particular, each process has its own memory
space.
Processes are often seen as synonymous with
programs or applications. However, what the user
sees as a single application may in fact be a set of
cooperating processes. To facilitate
communication between processes, most
operating systems support Inter Process
Communication (IPC).
A process is an execution stream in the context
of a particular process state.
◦ An execution stream is a sequence of instructions.
◦ Process state determines the effect of the instructions.
It usually includes (but is not restricted to):
Registers
Stack
Memory (global variables and dynamically allocated
memory)
Open file tables
Signal management information
◦ Key concept: processes are separated: no process can
directly affect the state of another process.
Process is a key OS abstraction that users see
- the environment you interact with when you
use a computer is built up out of processes.
◦ The shell you type stuff into is a process.
◦ When you execute a program you have just
compiled, the OS generates a process to run the
program.
◦ Your WWW browser is a process.
Two concepts: uniprogramming and
multiprogramming.
◦ Uniprogramming: only one process at a time. Typical example:
DOS. Problem: users often wish to perform more than one
activity at a time (load a remote file while editing a program,
for example), and uniprogramming does not allow this. So DOS
and other uniprogrammed systems put in things like memory-
resident programs that invoked asynchronously, but still have
separation problems. One key problem with DOS is that there
is no memory protection - one program may write the memory
of another program, causing weird bugs.
◦ Multiprogramming: multiple processes at a time. Typical of
Unix plus all currently envisioned new operating systems.
Allows system to separate out activities cleanly.
Multiprogramming introduces the resource
sharing problem - which processes get to use
the physical resources of the machine when?
One crucial resource:
Threads
Thread is unit of sequential execution
Threads are sometimes called lightweight processes.
Both processes and threads provide an execution
environment, but creating a new thread requires
fewer resources than creating a new process.
Threads exist within a process — every process has at
least one. Threads share the process's resources,
including memory and open files. This makes for
efficient, but potentially problematic, communication.
Multithreaded execution is an essential feature of the
Java platform. Every application has at least one
thread — or severa
Threads and processes
The unit of resource ownership is usually referred to as
a process or task. This Processes have:
◦ a virtual address space which holds the process image.
◦ protected access to processors, other processes, files, and I/O
resources.
The unit of dispatching is usually referred to a thread or a
lightweight process. Thus a thread:
◦ Has an execution state (running, ready, etc.)
◦ Saves thread context when not running
◦ Has an execution stack and some per-thread static storage for local
variables
◦ Has access to the memory address space and resources of its process
all threads of a process share this when one thread alters a
(non-private) memory item, all other threads (of the process)
sees that a file open with one thread, is available to others
Benefits of using threads
Benefits of Threads vs Processes
Less time to terminate a thread than a process.
Less time to switch between two threads within the
same process, partly because the newly created
thread uses the current process address space.
Less communication overheads -- communicating
between the threads of one process is simple
because the threads share everything: address
space, in particular. So, data produced by one
thread is immediately available to all the other
threads.
Some Example applications of threads
Example : A file server on a LAN
It needs to handle several file requests over a
short period
Hence more efficient to create (and destroy) a