import threading
import time

def io_bound_task(id):
    print(f"Thread {id} starting I/O-bound work")
    time.sleep(2)  # Simulates I/O delay
    print(f"Thread {id} finished I/O-bound work")

# Create and start multiple threads
threads = [threading.Thread(target=io_bound_task, args=(i,)) for i in range(4)]

start_time = time.time()

for thread in threads:
    thread.start()
for thread in threads:
    thread.join()

print("Total time with threading:", time.time() - start_time)
