Java Processes and Threads 프로 세 스 와 스 레 드
In concurrent programming, there are two basic units of execution: processes and threads. In the Java programming language, concurrent programming is mostly concerned with threads. However, processes are also important.
A computer system normally has many active processes and threads. This is true even in systems that only have a single execution core, and thus only have one thread actually executing at any given moment. Processing time for a single core is shared among processes and threads through an OS feature called time slicing.
It's becoming more and more common for computer systems to have multiple processors or processors with multiple execution cores. This greatly enhances a system's capacity for concurrent execution of processes and threads — but concurrency is possible even on simple systems, without multiple processors or execution cores.
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) resources, such as pipes and sockets. IPC is used not just for communication between processes on the same system, but processes on different systems.
하나의 프로 세 스 는 항상 하나의 응용 프로그램 으로 간주 되 지만,사실상 하나의 응용 프로그램 은 여러 개의 프로 세 스 가 있 을 뿐만 아니 라,프로 세 스 간 에는 IPC 를 통 해 통신 할 수 있다.
Most implementations of the Java virtual machine run as a single process. A Java application can create additional processes using a
ProcessBuilder
object. Multiprocess applications are beyond the scope of this lesson. Threads
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 several, if you count "system" threads that do things like memory management and signal handling. But from the application programmer's point of view, you start with just one thread, called the main thread. This thread has the ability to create additional threads, as we'll demonstrate in the next section.
다 중 스 레 드 실행 은 JAVA 플랫폼 운행 의 기본 특징 이다.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Is Eclipse IDE dying?In 2014 the Eclipse IDE is the leading development environment for Java with a market share of approximately 65%. but ac...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.