boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 版上牛人能不能帮忙看道面试题?
相关主题
js的oo和普通的oo有什么不同?
Computer vision Scientist 机器人和自动驾驶相关
也来一道c++的题
请教一个C++的问题
Amazon的LRU设计题
一个简单的java题
java多线程问题请教 (转载)
publication 要不要写进 resume
昨天onsite被问到的 multithreading 题目
amazon 面经
相关话题的讨论汇总
话题: stockcache话题: stock话题: public话题: quote话题: object
进入JobHunting版参与讨论
1 (共1页)
s********e
发帖数: 243
1
Write an object(class), called StockCache, that caches a single stock every
couple of minutes. What are the function prototypes? Where would you need to
put in thread protection? How would you organize the set of StockCache
objects?
我没啥思路,牛人们给指点一下。大概需要哪些member variables/functions. 关于
thread protection的问题怎么考虑?多谢了!!
s********e
发帖数: 243
2
还有没睡的么?自己先顶起来,别沉了
d**e
发帖数: 6098
3
我猜的
int cache_size ?
float[] cache ?
void updateCache(float value) ?
float getValueAt(int time) ?
updateCache需要上锁,防止多个线程同时更新。

every
to

【在 s********e 的大作中提到】
: Write an object(class), called StockCache, that caches a single stock every
: couple of minutes. What are the function prototypes? Where would you need to
: put in thread protection? How would you organize the set of StockCache
: objects?
: 我没啥思路,牛人们给指点一下。大概需要哪些member variables/functions. 关于
: thread protection的问题怎么考虑?多谢了!!

e****e
发帖数: 418
4
When we have a set of StockCache objects and a stock A to be cached, how do
we know if there is a StockCache object already holds a stock A of the last-
time version.
If true, the current version of stock A should replace the old one in the
StockCache object.
If not true, a new StockCache is created to hold the current version of
stock A object.
So we should have a StockCacheManager to do such check. We can replace a
existing stock cache or add a new stock cache through StockCacheManager. And
it
s********e
发帖数: 243
5
思路太清楚了啊!
热切期待您的TBC。。。

do
last-
And

【在 e****e 的大作中提到】
: When we have a set of StockCache objects and a stock A to be cached, how do
: we know if there is a StockCache object already holds a stock A of the last-
: time version.
: If true, the current version of stock A should replace the old one in the
: StockCache object.
: If not true, a new StockCache is created to hold the current version of
: stock A object.
: So we should have a StockCacheManager to do such check. We can replace a
: existing stock cache or add a new stock cache through StockCacheManager. And
: it

s*****n
发帖数: 5488
6
public class stock
{
private string StockId;
private Quote bars[];
}
public class quote{
//define TOCHLV here
}
public class StockCache
{
Stock stock;
Quote[] bars = new Quotes[const int length];
// access method
public void AssignStock(Stock s ){this.stock = s};
public void ReplaceBar(Quote bar);
public void RemoveBar(DateTIme minute);
public bar GetBar(Datetime minute);
public void clear();
public void
//properties
public int BarCount
}
put monitor on stock obj, Quote class, and you should

【在 s********e 的大作中提到】
: Write an object(class), called StockCache, that caches a single stock every
: couple of minutes. What are the function prototypes? Where would you need to
: put in thread protection? How would you organize the set of StockCache
: objects?
: 我没啥思路,牛人们给指点一下。大概需要哪些member variables/functions. 关于
: thread protection的问题怎么考虑?多谢了!!

c****o
发帖数: 41
7
也许应该用到写优先的readerwriterlock,这样可以允许多个线程读cache
1 (共1页)
进入JobHunting版参与讨论
相关主题
amazon 面经
系统设计请教
我的经验教训(1)
待字闺中版之FAQ
面经二:如何对付tough technical questions
我的找工作随想(EECS)
各大公司面试题(3)
答XDJM们的邮件(继我一个半月的找工作经历)
再帖一遍Amazon Onsite的题
Re: MS SQL database engineer(sr)ONSITE 面试该如何准备? (转载)
相关话题的讨论汇总
话题: stockcache话题: stock话题: public话题: quote话题: object