一切都只是文件和程序。
1 分•作者: ghassenfaidi•3 个月前
去年,在我大学计算机科学(CS)专业学习的第二年,我正在阅读《计算机网络:自顶向下方法》。在第二章的末尾,它包含了一系列可供实践的项目想法。我被深深地吸引住了。
我仍然记得当时的那种兴奋感,在我的笔记本电脑上禁用了防火墙(在设置中)(后来我意识到客户端不需要禁用防火墙:D)。
我编写了一个 Python 脚本,通过 TCP 发送“hello”,并在我朋友的笔记本电脑上运行“服务器”(它只是一个 Python 程序),服务器将其转换为大写,并发送回“HELLO”。
一周后,我完成了构建一个简单的多线程 HTTP 服务器。
我更改了路由器设置,将端口转发到我的笔记本电脑,这样任何人都可以随时随地使用我(不安全的)HTTP 服务器,成功地将我笔记本电脑上的所有文件置于风险之中:D
那一刻,一切都开始变得清晰,一切都只是一堆文件和程序。
我心想,“我爱计算机科学”,我真的热泪盈眶。
在高中时,我学习了一些计算机科学入门课程,其中一门课我们学习了一些非常基础的 PHP 和 MySQL。我们只需在安装程序中点击“下一步”就安装了 MySQL,然后突然之间,我们的 PHP 代码就可以将数据存储在“数据库”中了。我感到很困惑……就像“教授,数据库在哪里”,他没有理解我的问题,“我的意思是,这些东西存储在哪里?”
这确实是一个有点难的问题,但他回答我说“它只是一些文件”。
我没有完全相信,但至少它让我安心了……至少它在硬盘上!
在学习了操作系统、数据库和计算机网络之后,我终于明白了数据库在哪里。从某种意义上说,它只是一堆文件,以及顶部的几个 TCP 套接字。他是对的。
我不确定为什么接受一切都只是一堆文件和进程需要这么长时间才能内化。
查看原文
Last year, two years into my CS studies at college, I was reading Computer Networking: A Top Down Approach, at the end of chapter 2 it contained a list of project ideas to do. I was hooked.<p>I still remember the thrill I had, disabling the firewall (in the settings) on my laptop (later I realized the client doesn't need to disable the firewall :D)
Creating a python script that sends "hello" via TCP, and running the "server" (which is just a python program) on my friend's laptop, the server makes it uppercase, and sends "HELLO" back.
a week later I had finished building a simple multithreaded http server.
I changed the router setting to do port forwarding to my laptop, so that anyone can use my (insecure) HTTP server anywhere, successfully putting all the files on my laptop in risk :D<p>At that moment everything started to click, everything is bunch of files and programs.
I thought, "I love computer science", and I literally had tears in my eyes.<p>In high school I studied some introductory computer science classes, in one of them we were taught some very basic PHP and MySQL, we installed MySQL just by pressing "next" in the setup, and suddenly, our PHP code is storing data in the "database". I was puzzled... like "professor, where is the database", he didn't understand my question, "I mean where is this stuff stored?"
It was kind of tough question indeed, but he answered me "it's just some files".
I didn't buy it, but it set my heart at ease at least... at least it's on the hard disk!<p>After studying operating systems, databases and computer networking, I finally understood where is the database. in some sense, it's just bunch of files and some TCP socket on the top. he was correct.<p>I'm not sure why accepting that everything is just a bunch of files and processes takes so much time to internalize.