我如何在 C 中练习 Unix 编程? [英] How do I practice Unix programming in C?

查看:20
本文介绍了我如何在 C 中练习 Unix 编程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

经过五年的专业 Java(以及在较小程度上,Python)编程并慢慢觉得我的计算机科学教育正在消失,我决定要拓宽我的视野/对世界的普遍有用性,并做一些感觉更有意义的事情(对我来说)就像我真的对机器有影响一样.我选择学习 C 和 Unix 编程,因为我觉得这是很多最有趣的问题所在.

After five years of professional Java (and to a lesser extent, Python) programming and slowly feeling my computer science education slip away, I decided I wanted to broaden my horizons / general usefulness to the world and do something that feels more (to me) like I really have an influence over the machine. I chose to learn C and Unix programming since I feel like that is where many of the most interesting problems are.

我的最终目标是能够专业地做到这一点,如果没有其他原因,我必须每周花 40-50 小时在支付账单的工作上,所以它也可能是这种类型我想变得更好的编码.当然,你不会被雇来做你以前没有做过的事情,所以现在我自己在努力.

My end goal is to be able to do this professionally, if for no other reason than the fact that I have to spend 40-50 hours per week on work that pays the bills, so it may as well also be the type of coding I want to get better at. Of course, you don't get hired to do things you haven't done before, so for now I am ramping up on my own.

为此,我从 K&R 开始,这是一个很好的资源,部分原因是每个章节都有练习.之后,我转到了计算机系统:程序员的观点,后面是Unix环境中的高级编程十章.当我读完这本书时,我会阅读 Unix Network Programming.

To this end, I started with K&R, which was a great resource in part due to the exercises spread throughout each chapter. After that I moved on to Computer Systems: A Programmer's Perspective, followed by ten chapters of Advanced Programming in the Unix Environment. When I am done with this book, I will read Unix Network Programming.

我在史蒂文斯书中缺少的是缺乏编程问题;它们主要记录功能并提供示例,然后是一些章末问题.我觉得我会从挑战使用每一章中的知识中受益更多.我可以为每个函数编写一些测试程序,但这是一种不太理想的方法,因为 (1) 我可能没有遇到一些外部挑战时的积极性,并且 (2) 我自然只会考虑使用该函数以我已经想到的方式.

What I'm missing in the Stevens books is the lack of programming problems; they mainly document functionality and provide examples, with a few end-of-chapter questions following. I feel that I would benefit much more from being challenged to use the knowledge in each chapter a la K&R. I could write some test program for each function, but this is a less desirable method as (1) I would probably be less motivated than if I were rising to some external challenge, and (2) I will naturally only think to use the function in the ways that have already occurred to me.

所以,我想获得一些关于如何练习的建议.显然,我的第一选择是找到一些具有 Unix 编程挑战的资源.我还考虑过寻找并尝试为一些开源 C 项目做出贡献,但这有点令人生畏,因为在学习使用该软件然后学习代码库方面会有一些开销.我能想到的唯一一个我经常使用的开源 C 项目是 Python,我不确定它是否容易上手.

So, I'd like to get some recommendations on how to practice. Obviously, my first choice would be to find some resource that has Unix programming challenges. I have also considered finding and attempting to contribute to some open source C project, but this is a bit daunting as there would be some overhead in learning to use the software, then learning the codebase. The only open-source C project I can think of that I use regularly is Python, and I'm not sure how easy that would be to get started on.

也就是说,我愿意接受各种建议,因为有些事情我什至没有想到.

That said, I'm open to all kinds of suggestions as there are likely things I haven't even thought of.

推荐答案

重新发明许多核心 Unix 实用程序.其中大部分是(现在仍然是)用 C 编写的,因此它们是开始学习的好方法.根据您的技能,选择更难或更容易复制的实用程序.

Reinvent a lot of the core Unix utilities. Most of these were (and still are) written in C, so they are a good way to start off learning. Depending on your skill, pick harder or easier utilities to copy.

尝试编写自己的 malloc.你会学到很多关于 Unix 的知识,也会学到很多 C 编程.

Try writing your own malloc. You'll learn a lot about Unix and a lot of C programming as well.

谷歌计算机科学操作系统课程并在那里做项目.许多学校在公共网站上都有这些项目,因此您可以获得所需的一切.这里是普渡大学网站的链接.试一试 shell 项目;这很困难,但很有教育意义.

Google for computer science operating system courses and do the projects there. Many schools have these projects on public websites so you could get everything you need. Here is a link to Purdue's site. Give the shell project a shot; it was difficult, but really educational.

这篇关于我如何在 C 中练习 Unix 编程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆