6. processes and threads

Post on 16-Apr-2017

2.066 views 0 download

Transcript of 6. processes and threads

Hardware - OS course @ Telerik Software Academy

6 Processes and Threads

Marian MarinovCEO of 1H Ltd.mm@1h.com

Borislav VaradinovSystem Administratorbobi [ at ] itp.bg

What is a Process?

What is a Process?

Single process OS Arduino

Multy process OS Any modern kernel

What is a Process?

MEMORYCPUI/OAPPLICATION

Multiple Processes?

MEMORYCPUI/OAPPLICATION

APPLICATION

MEMORY

Multiple Processes?

Segmentation Fault

Bus Error

Access violation

SEGFAULT/SIGSEGV

Since Linux 3.2 CROSS MEMORY ATTACH

What is a Thread?

What is a Thread?

MEMORYCPUI/OThread1

Thread0

Process

What is a Thread?

Creating a process

FORK Copy the memory of the parent

Inherit FD table

Inherit credentials

Inherit security

EXEC Create new memory space

Inherit FD table

Inherit credentials

What is a Thread?

Creating a process

#include #include int main() {int i;pid_t p;p = fork();if (p == 0) {for (i=0;i