Icon New game New game

Sistemas Operativos Semana 4 Act 2

Fill in the Blanks

Estructura de Datos Semana 1

Download the paper version to play

0 times made

Created by

Colombia
This game is a version of

Top 10 results

There are still no results for this game. Be the first to stay in the ranking! to identify yourself.
Make your own free game from our game creator
Compete against your friends to see who gets the best score in this game

Top Games

  1. time
    score
  1. time
    score
time
score
time
score
 
game-icon

Fill in the Blanks

Sistemas Operativos Semana 4 Act 2Online version

Estructura de Datos Semana 1

by Anyelo Gerley Quintero Reyes
1

start tarea join hilo2 sleep

import threading
import time
#funcion que simula una tarea en un hilo
def ( nombre , duracion ) :
print ( f " El hilo { nombre } ha comenzado " )
time . ( duracion )
print ( f " El hilo { nombre } ha terminado " )
# Crear dos hilos que se ejecutarán en paralelo
hilo1 = threading . Thread ( target = tarea , args = ( " Hilo 1 " , 2 ) ) # Toma 2 segundos
hilo2 = threading . Thread ( target = tarea , args = ( " Hilo 2 " , 4 ) ) # Toma 2 segundos

# Iniciar los hilos
hilo1 . ( )
. start ( )

# Esperar a que ambos hilos terminen
hilo1 . ( )
hilo2 . join ( )

print ( " Todos los hilos han terminado . " )

educaplay suscripción