📣 黑五价提前开抢|VIP一年通行证5折,蓝莓、Offer多多同步特惠
12
返回列表 发新帖
楼主: returning
跳转到指定楼层
上一主题 下一主题
收起左侧

linkedin两轮电面

🔗
hyliu0000 2015-12-3 05:21:56 | 只看该作者
全局:
returning 发表于 2015-12-3 05:14
问的是virtual memory用太多有什么坏处。

恩 我就是想知道用多了有什么坏处。 楼主怎么答得?
回复

使用道具 举报

🔗
 楼主| returning 2015-12-3 08:40:51 | 只看该作者
全局:
hyliu0000 发表于 2015-12-3 05:21
恩 我就是想知道用多了有什么坏处。 楼主怎么答得?

貌似他只需要慢这个答案。
回复

使用道具 举报

🔗
hyliu0000 2015-12-3 10:59:09 | 只看该作者
全局:
楼主,第一个题你怎么答得? 我写了一个,能否把你的玉给引下来啊?
  1. class BoundedBlockingQueue{
  2.             Queue<Integer> q = new LinkedList<>();
  3.             Lock rwLock = new ReentrantLock();
  4.             Condition notFull = rwLock.newCondition();
  5.             Condition notWrite = rwLock.newCondition();
  6.             int capcity = 0;
  7.             AtomicInteger count = new AtomicInteger(0);
  8.             AtomicBoolean isWriting = new AtomicBoolean(false);
  9.             public BoundedBlockingQueue(int c) {
  10.                 capcity = c;
  11.             }

  12.             public void add(Integer elem) throws Exception{
  13.                 rwLock.lock();
  14.                 try {
  15.                     int i = 0;
  16.                     while (count.get() == capcity) {
  17.                         if (i == 0) System.out.println("queue is full, count is" + count.get());
  18.                         i++;
  19.                         notFull.await();
  20.                     }
  21.                     q.add(elem);
  22.                     count.incrementAndGet();
  23.                     System.out.println("added " + elem);
  24.                 }
  25.                 finally{rwLock.unlock();}
  26.             }

  27.             public Integer get() {
  28.                 rwLock.lock();
  29.                 try{
  30.                     Integer result = q.poll();
  31.                     count.decrementAndGet();
  32.                     notFull.signalAll();
  33.                     return result;
  34.                 }
  35.                 finally {
  36.                     rwLock.unlock();
  37.                 }

  38.             }

  39.             public void multipleWrite(List<Integer> elems) throws Exception{

  40.                 rwLock.lock();
  41.                 if(isWriting.get() == true) notWrite.await();
  42.                 isWriting.compareAndSet(false, true);
  43.                 for(Integer elem: elems){
  44.                     int i = 0;
  45.                     while(count.get() == capcity){
  46.                         if(i == 0) System.out.print("mutliple wirte full");
  47.                         i ++;
  48.                         notFull.await();
  49.                     }
  50.                     q.add(elem);
  51.                     count.incrementAndGet();
  52.                     System.out.println("added " + elem);
  53.                 }
  54.                 isWriting.compareAndSet(true, false);
  55.                 notWrite.signalAll();
  56.                 rwLock.unlock();
  57.             }
  58.         }
复制代码
回复

使用道具 举报

🔗
 楼主| returning 2015-12-3 11:45:59 | 只看该作者
全局:
您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限 或 查看其他获取积分的方式
Unlock interview details and practice with AI
Popular Interview Questions from Top Companies
回复

使用道具 举报

🔗
hercule24 2015-12-7 06:34:12 | 只看该作者
全局:
请问楼主 一轮之后 过了几天拿到的第二轮啊
回复

使用道具 举报

🔗
 楼主| returning 2015-12-7 07:18:41 | 只看该作者
全局:
hercule24 发表于 2015-12-7 06:34
请问楼主 一轮之后 过了几天拿到的第二轮啊

过了两天
回复

使用道具 举报

全局:
问一下楼主 只唤醒reader怎么实现?
回复

使用道具 举报

🔗
jkl3000 2017-4-5 15:09:34 | 只看该作者
全局:
不用浪费时间写thank you letter,面试官也没有时间看。写了还给人溜须拍马的感觉。engineer其实并不喜欢这样。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号
隐私提醒:
  • ☑ 禁止发布广告,拉群,贴个人联系方式:找人请去🔗同学同事飞友,拉群请去🔗拉群结伴,广告请去🔗跳蚤市场,和 🔗租房广告|找室友
  • ☑ 论坛内容在发帖 30 分钟内可以编辑,过后则不能删帖。为防止被骚扰甚至人肉,不要公开留微信等联系方式,如有需求请以论坛私信方式发送。
  • ☑ 干货版块可免费使用 🔗超级匿名:面经(美国面经、中国面经、数科面经、PM面经),抖包袱(美国、中国)和录取汇报、定位选校版
  • ☑ 查阅全站 🔗各种匿名方法

本版积分规则

>
快速回复 返回顶部 返回列表