Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Challenge: Classify Thread vs. Process Use Cases | Introduction to Concurrency
Practice
Projects
Quizzes & Challenges
Вікторини
Challenges
/
Python Multithreading and Multiprocessing
Секція 1. Розділ 4
single

single

bookChallenge: Classify Thread vs. Process Use Cases

Свайпніть щоб показати меню

In modern Python programming, choosing between threads and processes is a crucial design decision when building concurrent or parallel systems. Each approach has distinct strengths: threads shine in I/O-bound scenarios where tasks spend time waiting for input or output operations, while processes are ideal for CPU-bound workloads that benefit from true parallel execution. Consider the following real-world programming tasks and think about which concurrency model—threads or processes—would be most appropriate for each:

  • Downloading multiple web pages simultaneously;
  • Processing a large collection of high-resolution images;
  • Reading and writing records to a shared database;
  • Performing complex numerical computations on large datasets;
  • Monitoring multiple directories for file changes;
  • Running several independent machine learning model training jobs;
  • Logging sensor data from several networked devices in real time;
  • Rendering frames for an animated video;
  • Scraping data from multiple websites at once;
  • Compressing a batch of files into separate archives.
Завдання

Swipe to start coding

You are given a list of programming tasks that involve concurrency or parallel execution.

For each task, determine whether it is better suited to be implemented using threads or processes, based on factors such as shared memory, isolation, CPU-bound vs I/O-bound work, and fault tolerance.

Your task is to:

  • For each task, choose exactly one of the following values: "thread" or "process".
  • Assign your choice to the corresponding variable (task1, task2, ..., task10).
  • Do not change variable names.
  • Do not add or remove variables.
  • Use lowercase strings only: "thread" or "process".

Output format requirements:

  • Provide only the variable assignments shown below.
  • Do not include explanations, comments, or additional text.

Рішення

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 1. Розділ 4
single

single

Запитати АІ

expand

Запитати АІ

ChatGPT

Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат

some-alt