o******r 发帖数: 259 | 1 看到很多面试题都问这个,
有什么trick吗?
以前有道电梯设计拿process schedule类比,
这个饭店预订是什么来头呢? | m******t 发帖数: 2416 | 2 I guess you want to elaborate on how you would make sure it won't give the
same table to two parties at the same time? 8-)
【在 o******r 的大作中提到】 : 看到很多面试题都问这个, : 有什么trick吗? : 以前有道电梯设计拿process schedule类比, : 这个饭店预订是什么来头呢?
| o******r 发帖数: 259 | 3 我google到一个简单的uml design
就是轮询每张桌子,看能否满足指定时间的预订,
能就订上,并给个confirmation
这样太简单了吧?
如果是多个booking 操作同时进行,
加一个synchronization也可以了,
不过好象一般都是一个booking, 串行的.
【在 m******t 的大作中提到】 : I guess you want to elaborate on how you would make sure it won't give the : same table to two parties at the same time? 8-)
| p****s 发帖数: 32405 | 4 并行的, 这个用semaphore或mutex tasking的算法不行么?
【在 o******r 的大作中提到】 : 我google到一个简单的uml design : 就是轮询每张桌子,看能否满足指定时间的预订, : 能就订上,并给个confirmation : 这样太简单了吧? : 如果是多个booking 操作同时进行, : 加一个synchronization也可以了, : 不过好象一般都是一个booking, 串行的.
| o******r 发帖数: 259 | 5 我指的就是用semaphore/mutex之类的来同步,
好象题目更偏重于OOP design
看你用什么object
往简单了说,一个booking, 一个table,一个confirmation
或加一个client GUI
【在 p****s 的大作中提到】 : 并行的, 这个用semaphore或mutex tasking的算法不行么?
|
|