撸第三遍论文:
keywards:duration of time for which a content is cached; retention aware of caching;cloud storage rental costs;flash memory damage;storage cost at the cache ;download cost form the server;minimize the total cost subject to the node capacity constrains;This model for having retention time is motivated by two different practical problems:renting disk space in cloud network and retaining date in underlying hardware momery
System Model
- Multicast mode of transmission
If a file requested at slot t is present in the cache then it is served instantaneously with no additional cost; otherwise, the node forwards the request to the server. A server multicasts all the files that are requested in a slot as the traffic is delay-tolerant. A multicast transmission of a file is received by all cached including the ones that have not requested the file.
- Storage cost
Storing a file for duration y in cache incurs a storage cost g(y). y denotes the retention duration defined as the number of slots for which m is stored at cache n starting from t=0. Assume g(.) to be an increasing linear/convex polynomial function
![](https://img.haomeiwen.com/i216420/0e3f13c6054982cb.png)
-Download cost
A unit download cost is incurred on multicasting every file over a time frame of T slots.
Actually, the download cost is defined that thes file shouldn't been downloaded
额。。。就是:
本文假设一旦cache node向server请求文件时候,server回应在当前时间单元内所受到的所有请求,即将请求文件发送给所有cache nodes。
![](https://img.haomeiwen.com/i216420/13e926bc1d9880db.png)
ynm<t指文件m不在在节点n中出现,因为它只需在节点n中存在一个slot。
Then,
![](https://img.haomeiwen.com/i216420/92b31369ee756f0b.png)
y表示元素为ymn的矩阵;ymn表示文件m在缓存节点n停留时间
Problem Formulation
![](https://img.haomeiwen.com/i216420/a59e1b1bd2142a2b.png)
证明为NP-hard问题(3D-map)
第一个约束条件为缓存大小
Analytical result for linear storage cost
-
假设存储消耗与滞留时间为线性关系,则
存储消耗=k*滞留时间.png
Optimal retentions for a large cache
-
假设每个缓存节点可以缓存足够多的文件并且每个文件可以在缓存节点滞留足够长时间;then,
缓存无限制
Then,
IPb.png
Theorem 2.png
不懂,待看
![](https://img.haomeiwen.com/i216420/dc50b74e584a2948.png)
Then,
![](https://img.haomeiwen.com/i216420/d38238dc67edb241.png)
以上,整个证明过程只是为了转化为线性松弛问题,
A heuristic in algorithm
![](https://img.haomeiwen.com/i216420/c20766699e4af385.png)
注意:输入输出为文件停留时间的矩阵;
思考:在一组缓存节点中,每个缓存节点缓存着文件集,每个文件至少缓存在一个缓存节点,通过设置每个文件在不同缓存节点的滞留消耗,迭代找出缓存文件集缓存在缓存节点中消耗最小的一组缓存节点集合,即文件在多个缓存节点的最好安排。
Analytical results for convex storage cost
凸优化待续。。。。
撸第二遍论文:
补:第二遍看论文:提出存储消耗t和下载消耗d。
min t+d ;
s.t. capacity ......
t用在缓存中的滞留时间的函数表示,函数不需明确定义,但假设是线性的;d用至少一个节点对文件m的请求概率表示。
主要思路是将上述优化问题转化为线性整数优化。套路:
(1)、证明NP-hard------------match-------------3Dmatching
(2)、将t和d转化,为一个以内容滞留时间为变量的线性问题。
最终证明优化问题的时间复杂度为O(NlogN)。
(3)、基于NP-hard,解决方法present a heuristic.
第二种是转化为凸函数解决。没看。
问题:为什么要最小化内容滞留时间,占用内存的消耗用滞留时间体现?
论文没看懂,文中出现了IPC经典问题 哲学家就餐问题。为了证明不是一无所获,就简单研究了一下。说是
1、问题描述:一圆桌前坐着5位哲学家,两个人中间有一只筷子,桌子中央有面条。哲学家思考问题,当饿了的时候拿起左右两只筷子吃饭,必须拿到两只筷子才能吃饭。上述问题会产生死锁的情况,当5个哲学家都拿起自己右手边的筷子,准备拿左手边的筷子时产生死锁现象。
2、解决方法:
(1)、添加一个服务生,只有当经过服务生同意之后才能拿筷子,服务生负责避免死锁发生。
(2)、每个哲学家必须确定自己左右手的筷子都可用的时候,才能同时拿起两只筷子进餐,吃完之后同时放下两只筷子。
(3)、规定每个哲学家拿筷子时必须拿序号小的那只,这样最后一位未拿到筷子的哲学家只剩下序号大的那只筷子,不能拿起,剩下的这只筷子就可以被其他哲学家使用,避免了死锁。这种情况不能很好的利用资源。
实现了第二种方案。
3、第二中方案分析:
首先明确每个哲学家相当于一个线程。哲学家的定义及动作定义:name 方法有eating thking——>eating 时应确定两只fork都可用,在用完fork后同时放下并唤醒其他进程notifyAll(),即used[i]的设置;
定义Fork类,方法有put和take。
在定义主函数时,要定义与package相同名字。为实现线程占用资源,应定义run函数。run()方法当作普通方法的方式调用,程序还是要顺序执行,还是要等待run方法体执行完毕后才可继续执行下面的代码: 而如果直接用run方法,这只是调用一个方法而已,程序中依然只有主线程--这一个线程,其程序执行路径还是只有一条,这样就没有达到写线程的目的
package cn.edu.sdust.Philosopher;
/每个哲学家相当于一个线程/
class Philosopher extends Thread{
private String name;
private Fork fork;
public Philosopher(String name,Fork fork){
super(name);
this.name=name;
this.fork=fork;
}
public void run(){
while(true){
thinking();
fork.takeFork();
eating();
fork.putFork();
}
}
public void eating(){
System.out.println("I am Eating:"+name);
try {
sleep(1000);//模拟吃饭,占用一段时间资源
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void thinking(){
System.out.println("I am Thinking:"+name);
try {
sleep(1000);//模拟思考
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
class Fork{
/*5只筷子,初始为都未被用*/
private boolean[] used={false,false,false,false,false,false};
/*只有当左右手的筷子都未被使用时,才允许获取筷子,且必须同时获取左右手筷子*/
public synchronized void takeFork(){
String name = Thread.currentThread().getName();
int i = Integer.parseInt(name);
while(used[i]||used[(i+1)%5]){
try {
wait();//如果左右手有一只正被使用,等待
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
used[i ]= true;
used[(i+1)%5]=true;
}
/*必须同时释放左右手的筷子*/
public synchronized void putFork(){
String name = Thread.currentThread().getName();
int i = Integer.parseInt(name);
used[i ]= false;
used[(i+1)%5]=false;
notifyAll();//唤醒其他线程
}
}
//测试
public class ThreadTest {
public static void main(String []args){
Fork fork = new Fork();
new Philosopher("0",fork).start();
new Philosopher("1",fork).start();
new Philosopher("2",fork).start();
new Philosopher("3",fork).start();
new Philosopher("4",fork).start();
}
}
网友评论