What's the difference between Web Workers and Worker Threads?

Eamon·2021년 1월 22일
0

ArticleTranslation

목록 보기
3/3
post-thumbnail

이 글은 stackoverflow에 올라온 What's the difference between Web Workers and Worker Threads? 의 질문과 답변을 한국말로 해석한 글입니다.


I haven't been able to find any resources that explain the difference between Web Workers (https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers), which have been around for years and enable PWA's, and Worker Threads (https://nodejs.org/api/worker_threads.html#worker_threads_worker_threads), which have recently been released in Node.js.

나는 설명을 찾을수가 없어 웹 워커와 워커 스레드의 차이점 에 대한

To my understanding both are simply ways of allowing JavaScript to run code in multiple threads.

내 이해로는 둘 다 JavaScript가 여러 스레드에서 코드를 실행하도록 허용하는 단순한 방법인데 말이야.

So why are Worker Threads being released as a "new" thing?

그리고 왜 워커 스레드는 "새로운"것으로 배포 된거야?

Web Workers are a technology that exists in browsers.

웹 워커는 브라우저 안에 있는 기술이야

Worker Threads are a technology that exists in node.js.

워커 스레드는 node js 안에 있는 기술이야.

They have similar goals, but due to environment differences, they have different implementations.

그들은 비슷한 목적을 가지고 있지만 환경이 다르기 때문에 그들은 다른 구현방법을 가지고 있어.

To my understanding both are simply ways of allowing JavaScript to run code in multiple threads.

Yes, that is correct.

맞아 그거

With significant limitations such as no access to the same variables as the main thread and in the browser, no access to the DOM.

메인 스레드와 동일한 변수에 대한 접근이 없고 브라우저에서 DOM에 대한 접근 권한이 없는 것과 같은 중요한 제한 사항이 있어.

Communication between threads and the main thread is generally done via messaging.

스레드와 메인스레드 간의 커뮤니케이션은 대체적으로 메세지를 토앻서 이루어지지.

So why are Worker Threads being released as a "new" thing?

Node.js has not had the ability to run Javascript code in threads until the "new" Worker Threads.

node.js 는 work threads 가 나오기 전까지 자바스크립트 코드 안에서 스레드를 가질수있는 능력이 없었어.

node.js never had Web Workers.

노드Js 는 web workers 를 가진적이 없어

Web Workers have existed in the browser for awhile.

웹 워커들은 브라우저안에서 잠시동안 존재했지

Before Worker Threads, developers had to use multiple processes to involve additional CPUs or to keep CPU-intensive code from blocking the event loop.

웹워커 스레드 전에 개발자들은 멀티 프로세스를 사용했어야 했어 추가적인 cpu를 사용하기 위해서 또는 cpu 집약적인 코드를 가지기 위해서

Now, node.js developers can do this with Worker Threads.

이제 노드 js 개발자들은 워커스레드로 그걸 할수있지.

profile
Steadily , Daily, Academically, Socially semi-nerd Front Engineer.

0개의 댓글