并行编程模型 新丁 ANIC

ANI是一种实验性的高性能编程语言,它支持静态安全性、完全隐式的并行处理及面向对象编程。ANI试图打破传统的命令式编程范式,提供一种更直观、更易于编写并行程序的方法。该语言通过结构化但灵活的数据流管道实现高度优化,从而达到高效且避免了内存管理、线程锁等复杂问题。

  昨天在CSDN上看到了关于 ANIC的新闻,anic是一个处于开发过程中开源项目,建立在google code上,其讨论在google group上,但由于政府的负责任 ,已经登录不上去了,所以只看到其部分内容。

  被其吸引是因为其号称“比C快、比java安全,比脚本简单”,最近一直在考虑编程模型,在由重核搭建的集群上,如何容易的写出高性能的并行程序是目前HPC领域的一个重大挑战,即使在网络应用方面由于多核、时代的到来,如何利用好多核加速自己的应用程序,也是非常现实的问题。MPI、OpenMP或者 MPI+OpenMP是目前的主流技术方案,但是MPI程序写起来困难、调试也困难,至于正确性验证也没有好的解决方案。我们目前希望在UPC的基础上,衍生出适合重核异构集群的编程模型,但是目前来看,在性能上也面临着巨大挑战,而且在实际应用中upc没有被很多用户接受。而且upc从根本上讲其在编程性上只是减少了一些繁琐工作,在难度上并没有降低,例如同步、一致性、依赖与数据竞争等问题依然需要程序员自己保证。

  所以,看到anic后,特别是看到其introduction后,觉得如果真如其所说,则是非常漂亮的解决方案,但是在看了其Tutorial后,由于写的不完整,还没有体会到其在介绍中说的优点。现在将其内容放在后面,供大家欣赏,本想翻译成中文,奈何没有时间,有机会再说吧。

---------------------------------------------------

http://code.google.com/p/anic/

 

Introduction

anic is the reference implementation compiler for the experimental, high-performance, statically-safe, fully implicitly parallel, object-oriented, general-purpose dataflow programming language ANI.

Portably written using the GNU toolchain, anic works on all of the popular operating systems, including *nix, Mac OS X, and Windows (via Cygwin).

The Fast Track

Want to get started with ANI right away? Head over straight to the ANI Tutorial.

Got burning philosophical questions? The FAQ is this way.

Have something to say? Join in on the official ANI discussion group.

Ready to dive straight into the source? Go right ahead.

The Quirks

ANI is probably unlike any programming language you've encountered; it does away with state, variables, commands, stacks, and memory itself, as we know it. In ANI, the compiler sequences the ordering of your program logic for you, laying out as much of it as possible in parallel, and guaranteeing that the resulting binary will be statically safe and deadlock-free. Best of all, compiler technology has advanced to the point where you don't need to understand any of this to leverage it; that's anic's job!

Crazy? Most definitely. And yet strangely enough, it works!

Hello, World!

The language couldn't possibly be simpler...

"Hello, World!" ->std.out

Dining Philosophers Problem - A Complete, Well-Written, Correct Program

...or any more powerful...

philosopher = [[int id]] {
        chopstick
= [[int/]] <- 0;
        leftPhil
= [[philosopher]];
        rightPhil
= [[philosopher]];
       
        getChopsticks
= [[--> int/, int/]] { /leftPhil.chopstick, /rightPhil.chopstick --> };
        returnChopsticks
= [[int/ cs1, int/ cs2]] { /cs1 ->leftPhil.chopstick; /cs2 ->rightPhil.chopstick; };
        eat
= [[int/ cs1, int/ cs2 --> int/, int/]] {
               
"Philosopher " + id + " eating.../n" ->std.out;
               
/cs1, /cs2 -->;
       
};
       
        loopback
=> std.rand std.delay /getChopsticks eat ->returnChopsticks loopback;
};

numPhils
= 5;

philStream
= [[philosopher//]];
//[[std.gen]] <- numPhils {
       
[[philosopher]] <- {..} ->philStream;
        philStream
[..] ->philStream[..].leftPhil;
        philStream
[(.. + 1) % numPhils] ->philStream[..].rightPhil;
};

(for a more detailed explanation of why this works, see the FAQ)

Compare this with Wikipedia's much longer, much less efficient, and unintuitive Pascal solution to the problem -- and that's actually a "simple" solution leaning on high-level monitor constructions. For the real nightmare, try implementing this thing using pthreads (the industry standard). Given half an hour and some frustration, a well-experienced programmer could probably do it.

But why? There's ANI.

The Aim

Try to imagine, if you will, the amount of time and effort it would take you to write a bug-free, efficiently multithreaded real-time clock + infix calculator hybrid application in a language like C.

While you're thinking, here's a terse but complete implementation in ANI:

@std.in;
a
=[[0/]]; op=[[' '/]]; b=[[0/]]; r=[[0/]];
0 { clock => [[int ms]] { ("/r" + ms/1000.0 + ":" + a + op + b + "=" + r) ->std.out; 1 std.delay (ms+1) clock} };
inLoop
=> {/in->a /in->op /in->b inLoop};
//op ?? {'+': (/a+/b) '-': (/a-/b) '*': (/a*/b) '/': (/a//b) : 0} ->r;

ANI is an attempt to fuse the intuitive feel of shell scripting (and all of its perks like implicit parallelism) with the safety of strict compilation and the speed of hand-optimized parallel assembly: in other words, lightweight programming that runs even faster than typical C.

In short, ANI seeks to break out of the shackles of imperative programming -- a stale paradigm which for four decades has produced hundreds of clones of the same fundamental feature set, none of which offer intuitive hands-off concurrency, and differing only in what lengths they go to to sugar-coat the embarrassing truth that they're all just increasingly high-level assemblers at heart; ANI is inspired by the realization that in today's programming environment, your compiler should be doing more for you than a blind language translation!

The Bottom Line

Think of ANI as a way to write fast, statically-guaranteed safe, well-structured, and highly parallelized software without ever encountering memory management, threads, locks, semaphores, critical sections, race conditions, or deadlock.

The central philosophy of ANI programming is that you "type-and-forget". You describe what you want to happen to your data, and it just gets done -- and fast. ANI is lightweight like a shell script but fast like C, safe like Java, and implicitly massively parallel like a language for the parallel processing age should be.

ANI accomplishes these ambitious goals by way of two novel approaches:

  • a paradigm shift away from the intractable chaos of imperative-style memory twiddling in favor of structured but flexible dataflow pipelines that can be heavily optimized through static analysis, and
  • a paper-thin but extremely powerful micro-scheduling runtime that exploits experimental ideas such as dynamic code polymorphism to deliver fine-grained, safe, and fully implicit parallelism from the compiled pipelines

Warning: Computer Science Content!

To those more technically inclined, anic compiles source-specified pipeline definitions down to object code modules, which are linked with a runtime providing initialization code and a root arbitrator thread; the arbitrator spawns worker threads which are dynamically dispatched to the compiled pipelines in such a way that there are no memory conflicts.

Think of ANI source code as a blueprint for a set of train tracks. anic looks at this and builds a real train track for you (making it better wherever it can). The program is run by putting running trains onto the tracks, and it turns out that anic also hired a system administrator for you who will keep an eye on the trains to make sure they don't crash. That's ANI in a technical nutshell!

内容概要:本文详细记录了对一个Android ARM64静态ELF文件中字符串加密机制的逆向分析过程。该ELF文件的所有字符串均被加密,无法通过常规strings命令或IDA直接识别。作者通过分析发现,加密字符串存储在.rodata段,其解密所需信息(包括密文地址、长度和16位密钥)保存在.data.rel.ro段的40字节描述符中。核心解密函数sub_10F408采用自反的双pass流密码算法,结合固定密钥KEY_TERM(由.data段24字节数据计算得出),实现字节级非线性、位置与长度相关的加密。文章还复现了完整的Python解密脚本,并揭示了该保护机制的本质为代码混淆而非强加密,最终成功批量解密全部956条字符串,暴露程序真实行为,如shell命令模板、设备标识篡改、网络重置等操作。此外,文中还提及未启用的自定义壳框架及其反dump设计。; 适合人群:具备逆向工程基础的安全研究人员、二进制分析人员及对ELF保护技术感兴趣的开发者。; 使用场景及目标:①学习ELF二进制中字符串加密的典型实现方式与逆向突破口;②掌握从结构识别、函数追踪到算法还原的完整逆向流程;③理解“绑定二进制”的完整性校验设计及其局限性;④实践编写IDAPython脚本自动化提取与解密敏感数据。; 阅读建议:此资源以实战案例驱动,不仅展示技术细节,更强调逆向思维与验证方法,建议读者结合IDA调试环境,逐步跟随文中步骤进行动态分析与算法验证,深入理解每一步的推理依据。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值