Question d’entretien chez Google

Different ways of implementing

Réponse à la question d'entretien

Utilisateur anonyme

16 juin 2012

Actually you were asked to provide some form of synchronization so that only 3 threads, each of them can upload a file ( so at the max 3 files at any time). We can use a semaphore initialized with 3 and threads that upload the file should acquire the semaphore before uploading and they should release the semaphore once finishing the upload so that other waiting thread if any can start uploading.

1