Newest Viewed Downloaded

Processes: code migration

Processes: code migration

Process Concept

An operating system executes a variety of programs: Batch system – jobs Time-shared systems – user programs or tasks Process – a program in execution; process execution must progress in sequential fashion A process includes: program counter stack data section

Esempio: kernel linux 2.6.20.4

struct task_struct { volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */ … #ifdef CONFIG_SMP #ifdef __ARCH_WANT_UNLOCKED_CTXSW int oncpu; #endif #endif int prio, static_prio, normal_prio; cpumask_t cpus_allowed; unsigned int time_slice, first_time_slice; … /* task state */ struct linux_binfmt *binfmt; long exit_state; int exit_code, exit_signal; … pid_t pid; pid_t tgid;

Esempio: kernel linux 2.6.20.4

#ifdef CONFIG_CC_STACKPROTECTOR /* Canary value for the -fstack-protector gcc feature */ unsigned long stack_canary; #endif … /* process credentials */ uid_t uid,euid,suid,fsuid; gid_t gid,egid,sgid,fsgid; struct group_info *group_info; kernel_cap_t cap_effective, cap_inheritable, cap_permitted; … /* CPU-specific state of this task */ struct thread_struct thread; /* filesystem information */ struct fs_struct *fs; /* open file information */ struct files_struct *files; /* namespaces */ struct nsproxy *nsproxy; /* signal handlers */ struct signal_struct *signal; struct sighand_struct *sighand; … };

Diagram of Process State

CPU Switch From Process to Process

Single and Multithreaded Processes

User level threads

Cheap to create and destroy threads Thread administration is in user-space Create: allocating memory for a thread stack Destroy: freeing memory of the stack Create and Destroy are cheap Switching between threads is fast Store the CPU registers of the current thread Load the ones for the next thread

User level threads: Problem?

Invocation of a blocking call immediately block the entire process including all the threads of that process eg: blocking on I/O A thread blocking on I/O should never prevent other parts from being executed

Kernel Level threads

Implement threads in the OS’s kernel Create, delete, synchronization, … all take place via a system call Switching threads is as expensive as switching processes So, lose the benefit of using a thread instead of a process

Windows XP Threads

Implements the one-to-one mapping Each thread contains A thread id Register set Separate user and kernel stacks Private data storage area The register set, stacks, and private storage area are known as the context of the threads The primary data structures of a thread include: ETHREAD (executive thread block) KTHREAD (kernel thread block) TEB (thread environment block)

Linux Threads

Linux refers to them as tasks rather than threads Thread creation is done through clone() system call clone() allows a child task to share the address space of the parent task (process)

Thread Usage in Nondistributed Systems

Context switching as the result of IPC

Thread Implementation

Combining kernel-level lightweight processes and user-level threads.

Multithreaded Servers (1)

A multithreaded server organized in a dispatcher/worker model.

Multithreaded Servers (2)

Parallelism, nonblocking system calls Finite-state machine No parallelism, blocking system calls Single-threaded process Parallelism, blocking system calls Threads Characteristics Model Three ways to construct a server.

The X-Window System

Provides GUI interface to UNIX based systems A protocol, not a product Operating system independent X win implementation: Motif - Open Software Foundation (OSF) Open Look - Sun/AT&T The Client/Server terminology is REVERSED for X Windows Client: the application which requests the GUI display and provides the service. Located on the server node Server: Program that provides the GUI display

The X-Window System

The basic organization of the X Window System

Servers: General Design Issues

3.7 Client-to-server binding using a daemon as in DCE Client-to-server binding using a superserver as in UNIX

Reasons for Migrating Code

The principle of dynamically configuring a client to communicate to a server. The client first fetches the necessary software, and then invokes the server.

Showing 1 - 20 of 52 items Details

Name: 
070-processes
Author: 
Steve Armstrong
Company: 
East Texas Data Service
Description: 
Processes: code migration
Tags: 
process | migrat | thread | system | move | server | state | execut
Created: 
5/10/2001 3:23:06 PM
Slides: 
52
Views: 
31
Downloads: 
5
Rating: 
0


> Comment



Share this presentation
|

Comments

Share this presentation:

|
Sitemap