python
import threading
shared_resource = 0
lock = threading.Lock()
def update_shared_resource():
global shared_resource
with lock:
shared_resource += 1
threads = []
for _ in range(5):
thread = threading.Thread(target=update_shared_resource)
threads.append(thread)
thread.start()
for thread in threads:
thread.join()