memory

Can a lower level cache have higher associativity and still hold inclusion?

独自空忆成欢 提交于 2020-01-12 23:15:31
问题 Can a lower level cache have higher associativity and still hold inclusion? Suppose we have 2-level of cache.(L1 being nearest to CPU and L2 being nearest to main memory) L1 cache is 2-way set associative with 4 sets and let's say L2 cache is direct mapped with 16 cache lines and assume that both caches have same block size. Then I think it will follow inclusion property even though L1(lower level) has higher associativity than L2 (upper level). As per my understanding, lower level cache can

Need help allocating a far pointer on Borland C++ 3.0

倖福魔咒の 提交于 2020-01-12 15:45:27
问题 I am writing a DOS game framework to learn C better and a general interest in programming on old hardware (especially on the system I grew up with). I am trying to implement a double buffer system but I am having trouble allocating a far pointer to a 320*200 array. At first I was trying to use malloc but found out it can only allocate under 64kb. I read that you need to use farmalloc (malloc returns NULL) and it allocated correctly. However, when _fmemset or _fmemcpy is run.... the whole

POSIX rlimit: What exactly can we assume about RLIMIT_DATA?

旧街凉风 提交于 2020-01-12 14:11:19
问题 Prequisites POSIX.1 2008 specifies the setrlimit() and getrlimit() functions. Various constants are provided for the resource argument, some of which are reproduced below for easier understaning of my question. The following resources are defined: (...) RLIMIT_DATA This is the maximum size of a data segment of the process, in bytes. If this limit is exceeded, the malloc() function shall fail with errno set to [ENOMEM]. (...) RLIMIT_STACK This is the maximum size of the initial thread's stack,

设计模式 —— 建造者模式

别等时光非礼了梦想. 提交于 2020-01-12 13:48:27
一.什么是构建者模式: 将一个复杂的对象的构建与它的表示分离,使得同样的构建过程可以创建不同的表示。创建者模式隐藏了 复杂对象的创建过程,它把复杂对象的创建过程加以抽象,通过子类继承或者重载的方式,动态的创建具 有复合属性的对象。 二.适用场景: 1、隔离复杂对象的创建和使用,相同的方法,不同执行顺序,产生不同事件结果 2、多个部件都可以装配到一个对象中,但产生的运行结果不相同 3、产品类非常复杂或者产品类因为调用顺序不同而产生不同作用 4、初始化一个对象时,参数过多,或者很多参数具有默认值 5、不适合创建差异性很大的产品类产品内部变化复杂,会导致需要定义很多具体建造者类实现变化, 增加项目中类的数量,增加系统的理解难度和运行成本 6、需要生成的产品对象有复杂的内部结构,这些产品对象具备共性 三.主要作用: 在用户不知道对象的建造过程和细节的情况下就可以直接创建复杂的对象。 用户只需要给出指定复杂对象的类型和内容; 建造者模式负责按顺序创建复杂对象(把内部的建造过程和细节隐藏起来) 四.解决的问题: 方便用户创建复杂的对象(不需要知道实现过程) 代码复用性 & 封装性(将对象构建过程和细节进行封装 & 复用) 五.优缺点: 优点: 使用建造者模式可以使客户端不必知道产品内部组成的细节。 具体的建造者类之间是相互独立的,这有利于系统的扩展。 具体的建造者相互独立

soldidity学习——internal和external

拜拜、爱过 提交于 2020-01-12 11:48:38
一、external顾名思义,当函数加了这个修饰之后,只能在外部被调用,而不能在合约内部被其他函数所调用。在本例中,如果我们在test函数中直接调用changge函数(return changge()),编译会不通过。但是如果我们在changge前加上this,相当于给函数制定外部调用地址,那么编译可以通过。该规则在继承中同样适用。 pragma solidity^0.5.0; contract ExternalTest{ function changge()external pure returns(string memory){ return "changge"; } function test()public view returns(string memory){ return this.changge(); } } 二、与external相反,internal修饰的函数,只能在合约内部被其他函数所调用,比如下面例子中,我们给跳舞这个方法加了internal修饰后,在图片1处不显示tiaowu这个函数,但是我们可以通过test来调用这个函数,调用后同样输出字符串“tiaowu”。 pragma solidity^0.5.0; contract InternalTest{ function tiaowu()internal pure returns(string memory

Why doesn't the instruction reorder issue occur on a single CPU core?

点点圈 提交于 2020-01-12 10:35:27
问题 From this post: Two threads being timesliced on a single CPU core won't run into a reordering problem. A single core always knows about its own reordering and will properly resolve all its own memory accesses. Multiple cores however operate independently in this regard and thus won't really know about each other's reordering. Why can't the instruction reorder issue occur on a single CPU core? This article doesn't explain it. EXAMPLE : The following pictures are picked from Memory Reordering

java jstack tool insufficient memory or insufficient privilege to attach

*爱你&永不变心* 提交于 2020-01-12 07:35:28
问题 I am really confused about: In my windows 2008r2, I have a windows service, in fact it's a java progress running as SYSTEM user. Now, I use Jstack rawly to the the service. But it occur error : insufficient memory or insufficient privilege to attach But if I use Jstack's options -F , it can work finely. I view the jdk's source, It uses a class BugSpotAgent to finish above. I want to know the root cause I can't use Jstack rawly, is it the SYSTEM user privilege problem? I also have try to use

java jstack tool insufficient memory or insufficient privilege to attach

我的梦境 提交于 2020-01-12 07:35:05
问题 I am really confused about: In my windows 2008r2, I have a windows service, in fact it's a java progress running as SYSTEM user. Now, I use Jstack rawly to the the service. But it occur error : insufficient memory or insufficient privilege to attach But if I use Jstack's options -F , it can work finely. I view the jdk's source, It uses a class BugSpotAgent to finish above. I want to know the root cause I can't use Jstack rawly, is it the SYSTEM user privilege problem? I also have try to use

Best way to track down a memory leak (C#) only visible on one customer's box

只愿长相守 提交于 2020-01-12 06:53:06
问题 What is the best way to track down a memory leak that is only found on one customer's test/release box, and no where else? 回答1: dotTrace3.1 (This question is kinda funny, cause I am tracking a mem leak that isn't present on my machine ...) 回答2: Try a memory profiler like ANTS Profiler. 回答3: If the user has the problem it consistently, take a stackdump and analyse in the standard way 回答4: It's either code, data or configuration. Since you say the code is not faulty 100% of the time, I would

Evaluate software minimum requirements

我们两清 提交于 2020-01-12 06:00:13
问题 Is there a way to evaluate the minimum requirements of a software? I mean, how can I discover, for example, the minimum amount of RAM that my application will need? Thanks! 回答1: A profiler will not help you here. Neither will estimating the size of data structures. A profiler can certainly tell you where your code is spending the most CPU time, but it will not tell you if you are missing performance targets - e.g. if your users will be happy, or unhappy with the performance of your