Thread

kido-c·2021년 5월 20일
0

> Defination from Wekipedia

A thread in computer science is short for a thread of execution. Threads are a way for a program to divide (termed "split") itself into two or more simultaneously (or pseudo-simultaneously) running tasks. Threads and processes differ from one operating system to another but, in general, a thread is contained inside a process and different threads in the same process share the same resources while different processes in the same multitasking operating system do not. Threads are lightweight, in terms of the system resources they consume, as compared with processes.


Threads are a way for a program to divide (termed "split") itself into two or more simultaneously (or pseudo-simultaneously) running tasks.

-> 스레드는 방법이다. 프로그램이 자기자신을 두개 또는 더 많은 실행중인 작업으로 나누기위한 그것도 동시에...

Threads and processes differ from one operating system to another but, in general, a thread is contained inside a process and different threads in the same process share the same resources while different processes in the same multitasking operating system do not.

-> 스레드과 프로세스는 하나의 운영시스템마다 다르다, 하지만 보통 프로세스는 스레드를 포함한다. 그리고 같은 프로세스 안의 다른 스레드는 같은 리소스를 공유한다.(멀티 스레드의 장점) 반면에 같은 멀티 테스킹 운영 시스템 안의 다른 프로세스는 서로 공유하지 않는다.

Multi-Thread

하나의 프로세스 안의 여러개의 스레드

Advantages and Disadvantages of Multithreaded Processes

Advantages of Multithreaded Processes

  • All the threads of a process share its resources such as memory, data, files etc. A single application can have different threads within the same address space using resource sharing.
    -> 다른 스레드간의 리소스 공유!!

  • It is more economical to use threads as they share the process resources. Comparatively, it is more expensive and time consuming to create processes as they require more memory and resources.
    -> 스레드를 사용하는 것이 더 경제적!! 프로세스를 만드는 것은 비싸고 시간소비 많음

  • Program responsiveness allows a program to run even if part of it is blocked using multithreading. This can also be done if the process is performing a lengthy operation.
    -> 부분이 막히더라고 작업 수행 가능 / 리소스 공유가 가능하기 때문

  • In a multiprocessor architecture, each thread can run on a different processor in parallel(평행적) using multithreading. This increases concurrency of the system. This is in direct contrast to a single processor system, where only one process or thread can run on a processor at a time.
    -> 병렬적, 평행적, 작업수행을 하기때문에 같은 작업이라고 할때 작업 수행 시간이 감소


Disadvantages of Multithreaded Processes

  • Multithreaded processes are quite complicated. Coding for these can only be handled by expert programmers.
    -> 코드가 복잡하다... 전문가가 필요하다

  • It is difficult to handle concurrency in multithreaded processes. This may lead to complications and future problems.
    -> 동시성을 핸들링하기가 어렵다.

  • Identification and correction of errors is much more difficult in multithreaded processes as compared to single threaded processes.
    -> 싱글 스레드와 비교하여 오류의 수정과 식별이 어렵다

profile
개발자 꿈나무

0개의 댓글