第一周 ARTS

ARTS第一周(求 a 的 b 次方对 p 取模的值) ARTS 第一周 Algorithm 快速幂。 Review 分享最近学习的机器学习。 Tip 搭建个人网站。 Share 学习新知识的路径。 Algorithm 快速幂 题目 求 a 的 b 次方对 p 取模的值。 输入格式 三个整数 a,b,p ,在同一行用空格隔开。 输出格式 输出一个整数,表示ab mod p的值。 数据范围 1≤a,b,p≤109 输入样例: 3 2 7 输出样例: ... 阅读详情

 

 第一周 ARTS

From 2019/6/17 To 2019/6/23  

Type

Completed Date

Contents

Finish

Algorithm

2019-6-18

Two Sum;Add Two Numbers

[x]

Review

2019-6-19

A Brief History of Object-Oriented Programming

[x]

Tips

2019-6-20

Telent On Http 

[x]

Share

2019-6-24

Review Computer Composition:RISC/CISC

[x]

Summary

1、inefficiency.

2、more detail on the analysic of the result and process

Improvement

1、pick out Tomato Work Method,record the time of your waste.

2、optimize code accroding the result

 


 

 

0

Algorithm:

LeetCode.com

    1. Two Sum(Easy)

Given an array of integers, return indices of the two numbers such that they add up to a specific target.

You may assume that each input would have exactly one solution, and you may not use the same element twice.

Example:

Given nums = [2, 7, 11, 15], target = 9,

Because nums[0] + nums[1] = 2 + 7 = 9,

return [0, 1].

c# Code

        

public static int[] TwoSum1(int[] nums, int target)

        {

            for (int i = 0; i < nums.Length; i++)

            {

                for (int j = i + 1; j < nums.Length; j++)

                {

                    if (nums[i] + nums[j] == target)

                    {

                        return new int[] { i, j };

                    }

                }

            }

            return null;

        }

        public static int[] TwoSum2(int[] nums, int target)

        {

            List<int> list = new List<int>();

            for (int i = 0; i < nums.Length; i++)

            {

                list.Add(nums[i]);

            }

            for (int j = 0; j < nums.Length; j++)

            {

                if (list.Contains(target - nums[j]) && list.IndexOf(target - nums[j]) !=  j)

                    return new int[2] { j, list.IndexOf(target - nums[j]) };

            }

            return null;

        }

        public static int[] TwoSum3(int[] nums, int target)

        {

            List<int> list = new List<int>();

            for (int j = 0; j < nums.Length; j++)

            {

                list.Add(nums[j]);

                int completation = target - nums[j];

                if (list.Contains(completation) && list.IndexOf(completation) != j)

                    return new int[2] { j, list.IndexOf(completation) };

            }

            return null;

        }

2. Add Two Numbers

Medium

You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.

You may assume the two numbers do not contain any leading zero, except the number 0 itself.

Example:

Input: (2 -> 4 -> 3) + (5 -> 6 -> 4)

Output: 7 -> 0 -> 8

Explanation: 342 + 465 = 807.

 

c# code 

 public static ListNode AddTwoNumbers1(ListNode l1, ListNode l2)

            {

                ListNode l1Current=l1;

                ListNode l2Current=l2;

                ListNode resultListCurrent = null;

                ListNode resultListHead= null;

                bool isCarry = false;

                do

                {

                    int result= (l1Current!=null?l1Current.val:0) + (l2Current != null ?  l2Current.val:0)+(isCarry?1:0);

                    isCarry = false;

                    if (result > 9) {

                        result =  Convert.ToInt32(result.ToString().Substring(result.ToString().Length - 1));

                        isCarry = true;

                    }

                    ListNode resultNode= new ListNode(result) { next = null };

                    if (resultListCurrent != null)

                        resultListCurrent.next = resultNode;

                    else

                        resultListHead = resultNode;

                    resultListCurrent = resultNode;

                    l1Current = l1Current != null ? l1Current.next : null ;

                    l2Current = l2Current != null ? l2Current.next : null;

                } while (!(l1Current == null &&l2Current == null&& !isCarry));

                return resultListHead;

            }

        public static ListNode AddTwoNumbers2(ListNode l1, ListNode l2)

        {

            ListNode l1Current = l1;

            ListNode l2Current = l2;

            ListNode resultListCurrent = null;

            ListNode resultListHead = null;

            bool isCarry = false;

            do

            {

                int result = (l1Current != null ? l1Current.val : 0) + (l2Current !=  null ? l2Current.val : 0) + (isCarry ? 1 : 0);

                isCarry = result/10 >0? true:false ;

                

                ListNode resultNode = new ListNode(result%10) { next = null };

                if (resultListCurrent != null)

                    resultListCurrent.next = resultNode;

                else

                    resultListHead = resultNode;

                resultListCurrent = resultNode;

                l1Current = l1Current != null ? l1Current.next : null;

                l2Current = l2Current != null ? l2Current.next : null;

            } while (!(l1Current == null && l2Current == null && !isCarry));

            if (isCarry)

                resultListCurrent.next = new ListNode(1);

            return resultListHead;

        }

 

 

Review:

A Brief History of Object-Oriented Programming

 面向对象简史

 

SIMULA was the first object language. As its name suggests it was used to create simulations. Alan Kay, who was at the University of Utah at the time, liked what he saw in the SIMULA language. He had a vision of a personal computer that would provide graphics-oriented applications and he felt that a language like SIMULA would provide a good way for non-specialists to create these applications. He sold his vision to Xerox Parc and in the early 1970s, a team headed by Alan Kay at Xerox Parc created the first personal computer called the Dynabook. Smalltalk was the object-oriented language developed for programming the Dynabook. It was a simulation and graphics-oriented programming language. Smalltalk exists to this day although it is not widely used commercially.

 

SIMULA是第一个面向对象语言。名字就说明这是用于创造。Alan Kay还在犹他大学读书的时候,就很喜欢这类语言。他有一台装有图像对象程序的个人电脑,那时他就觉得应该用像SIMULA这样完美范式的编程语言来编写程序。在20世纪70年代他把他的想法带到了施乐公司,并且带领了团队创造了一个叫DynaBook的个人电脑,里面包含SmallTalk这种面向对象的编程语言环境,SmallTalk是带有图形化界面得编程语言,很可惜的是,SmallTalk并没有得到很广泛的应用和商用。

The idea of object-oriented programming gained momentum in the 1970s and in the early 1980s Bjorn Stroustrup integrated object-oriented programming into the C language. The resulting language was called C++ and it became the first object-oriented language to be widely used commercially.

SmallTalk面向对象的设计在20世纪70年代掀起了浪潮,20世纪80年代初期Bjorn Stroustrup把面向对象集成在了C语言,因此产生了叫C++,并且得到广泛的应用和商用。

In the early 1990s a group at Sun led by James Gosling developed a simpler version of C++ called Java that was meant to be a programming language for video-on-demand applications. This project was going nowhere until the group re-oriented its focus and marketed Java as a language for programming Internet applications. The language has gained widespread popularity as the Internet has boomed, although its market penetration has been limited by its inefficiency.

在20世纪90年代初期,在Sun公司的James Gosling开发出一个叫JAVA的简单c++版本,用于控制音像应用的项目。直到SUN重新把JAVA作为互联网程序商用的时候,这个项目早就被废弃了。即使JAVA的效率比较低,但是在互联网依然产生了巨大的影响并且得到很广泛的应用。

 

Objects

Object-oriented programming is first and foremost about objects. Initially object-oriented languages were geared toward modeling real world objects so the objects in a program corresponded to real world objects. Examples might include:

  1. Simulations of a factory floor--objects represent machines and raw materials

  2. Simulations of a planetary system--objects represent celestial bodies such as planets, stars, asteroids, and gas clouds

  3. A PC desktop--objects represent windows, documents, programs, and folders

  4. An operating system--objects represent system resources such as the CPU, memory, disks, tapes, mice, and other I/O devices

 

对象

面向对象编程是第一个且主要针对对象的语言,首先面向对象语言是对现实世界对象的建模,然后在程序中的对象反映现实世界。

可以从以下4个例子可以看出:

1、工厂车间--机器和原材料

2、行星系--大行星,星星,小行星,云集(尘埃?)

3、个人电脑--windows操作系统、文件系统、程序集、文件夹

4、操作系统-CPU、内存、硬盘、磁盘、麦克风、外设IO设备

 

The idea with an object is that it advertises the types of data that it will store and the types of operations that it allow to manipulate that data. However, it hides its implementation from the user. For a real world analogy, think of a radio. The purpose of a radio is to play the program content of radio stations (actually translate broadcast signals into sounds that humans can understand). A radio has various dials that allow you to control functions such as the station you are tuned to, the volume, the tone, the bass, the power, and so on. These dials represent the operations that you can use to manipulate the radio. The implementation of the radio is hidden from you. It could be implemented using vacuum tubes or solid state transistors, or some other technology. The point is you do not need to know. The fact that the implementation is hidden from you allows radio manufacturers to upgrade the technology within radios without requiring you to relearn how to use a radio.

这些对象可以保存对应的数据,也可以操作这些数据,对象如何实现的话对于用户来说是不透明的。拿现实世界的收音机来说,它是用来播放一些音频音带音乐的(实际是广播一些人们能听懂的信号),收音机上有多个功能按钮可以操作,例如可以换频道、调声音、调音质、电源开关等等,这些都是你能操作控制收音机的功能,例如用了哪些二极管、晶体管或者其他技术,这些功能如何实现的用户不需要知道。事实上,哪怕收音机进行了技术升级,你也不需要重新学习如何使用它。

The idea is the same with objects. An object advertises the set of functions it will perform for you but does not reveal its implementation. Think of it as a black box. For example, think of the objects on a desktop. For simplicity think of two types of objects, a document and a program. A document contains data and a program contains executable statements. The desktop needs some functions to manipulate these objects. For example, it needs to be able to copy, cut, and paste these objects. It does not care how these objects are implemented. It just needs them to perform those three functions. Consequently both documents and programs provide functions that allow them to be copied, cut, and pasted.

对于对象也是一样,对象有一系列的功能对于你来说透明的,对于使用的人是不透明的。例如说,现在这个对象就是个人电脑,个人电脑有两个对象,文件和程序,文件包括数据,程序包括可执行的指令,电脑需要一些功能可以控制这些对象,对于文件来说,你可能想可以复制、剪切、粘贴这三个功能,我们并不关心这些功能是如何实现的,我们只需要用他们来实现这三个功能即可,所以文件和程序都应该提供这三个功能。

As another example, consider a stack. A stack provides a set of operations such as push, pop, isempty, and top. If the stack is implemented as an object, its implementation will be hidden from the program. It may be implemented as an array, a queue, or some other data structure. The program does not need to know how the array is implemented. Its only concern is that the stack provide the specified operations and that the operations provide the desired behavior.

另外一个例子,栈,提供压栈、退栈、空栈、栈顶等一系列的操作,如果栈是一个对象,那么对于程序调用方来说是不透明的。当然,他可以被数组、队列或其他的数据结构实现这些功能,程序不需要知道数组是如何实现这些功能的,他只需要栈提供了这些指定的功能并且产生你所期望的结果。

The set of operations provided by an object is called its interface. The interface defines both the names of the operations and the behavior of these operations. In essence the interface is a contract between the object and the program that uses it. The object guarantees that it will provide the advertised set of operations and that they will behave in a specified fashion. Any object that adheres to this contract can be used interchangeably by the program. Hence the implementation of an object can be changed without affecting the behavior of a program. For example, we can replace a stack object that is implemented as an array with a stack object that is implemented as a queue without affecting the behavior of the program.

对象提供一系列的功能称为它的接口,它定义了功能的名称和功能的作用。从本质上来说,接口就是程序和对象之间的约定,对象保证了它提供这些功能会产生期望的结果。任何遵循此约定的对象都可以被程序切换地调用,程序切换调用实现了这些功能的对象不会对结果产生任何影响。例如,我们可以把实现了栈的数组换成队列,也不会对程序结果产生任何影响。

 

Classes

An object is not much good if each one must be custom crafted. For example, radios would not be nearly as prevalent if each one was handcrafted. What is needed is a way to provide a blueprint for an object and a way for a "factory" to use this blueprint to mass produce objects. Classes provide this mechanism in object-oriented programming. A class is a factory that is able to mass produce objects. The programmer provides a class with a blueprint of the desired type of object. A "blueprint" is actually composed of:

  1. A declaration of a set of variables that the object will possess,

  2. A declaration of the set of operations that the object will provide, and

  3. A set of function definitions that implements each of these operations.

The set of variables possessed by each object are called instance variables. The set of operations that the object provides are called methods. For most practical purposes, a method is like a function.

 

如果一个对象都是由每个人去自定义的,那么这个对象就不能够高度统一。如果每一个收音机都是手工制作的,这样的话收音机没办法做到很流行,那么久需要针对这个对象绘制蓝图(模具)给到工厂去大规模的量化生产。程序员提供了描述这个对象的蓝图的类,那么蓝图应当有以下3方面组成:

1、声明对象的一系列的变量

2、声明对象提供的一系列的功能

3、定义一系列的功能

对象的变量称为实例变量,对象的功能称为方法,对于绝大部分的实例来说,方法就是功能。

When a program wants a new instance of an object, it asks the appropriate class to create a new object for it. The class allocates memory to hold the object's instance variables and returns the object to the program. Each object knows which class created it so that when an operation is requested for that object, it can look up in the class the function that implements that operation and call that function.

如果程序想要实例化对象,那么可以新建一个合适的类去实例化。类通过分配内存去保存对象的实例变量和返回对象给程序,每一个实例化对象,当想要执行这个对象的功能时,都可以通过查找类方法,并且调用它。

Inheritance

To motivate inheritance, think of a radio alarm clock. A radio alarm clock has all of the functions of a radio plus additional functions to handle the alarm clock. If we adopt the radio's interface for the radio alarm clock, then someone who knows how to operate a radio will also know how to operate the radio portion of the radio alarm clock. Hence, rather than designing the radio alarm clock from scratch, we can extend or inherit the interface defined by the radio. Of course, we can also use the existing implementation for a radio and extend it to handle the alarm clock functions.

 

要说到继承,可以想想收音机和闹钟的关系。收音机闹钟需要在收音机所有的功能上额外添加的功能。如果我们想收音机的接口上添加闹钟的功能,那么其他原先已经知道如何使用收音机的人也会知道如何调用闹钟的功能。所以,与其因为闹钟的功能重新设计收银机的接口,我们不如直接用继承实现或者接口实现的方法来实现。当然了,我们也可以从原先已经实现收音机接口的对象中并拓展这个闹钟的功能。

In object-oriented programming, Inheritance means the inheritance of another object's interface, and possibly its implementation as well. Inheritance is accomplished by stating that a new class is a subclass of an existing class. The class that is inherited from is called the superclass. The subclass always inherits the superclass's complete interface. It can extend the interface but it cannot delete any operations from the interface. The subclass also inherits the superclass's implementation, or in other words, the functions that implement the superclass's operations. However, the subclass is free to define new functions for these operations. This is called overriding the superclass's implementation. The subclass can selectively pick and choose which functions it overrides. Any functions that are not overridden are inherited.

在面向对象编程中,继承意味着是继承其他对象,也可能本身的实现。继承是通过新建一个子类继承已经存在的类,这个已经存在的称为父类。子类通常要完整实现父类的,可以继承接口但不能删掉接口的任何一个功能,也就是说,要实现父类的所有功能方法。当然,子类可以定义新的方法来实现这些功能,这就是方法的覆盖,子类可以自由选择哪些方法覆盖,哪些方法不被覆盖。没有任何一个方法被覆盖的情况叫做继承。

 

There is a great deal of debate about how to use inheritance. In particular, the debate swirls about whether inheritance should be used when you want to inherit an interface or whether it should be used when you want to inherit implementation. For example, suppose that you want to define a search object that stores (key, value) pairs and allows values to be looked up by providing their keys. More precisely, let us say that the search object supports the following operations:

  • insert: Adds a (key, value) pair to the object.

  • delete: Deletes a (key, value) pair from the object.

  • lookup: Given a key retrieves the value associated with that key from the object.

Later we decide that we want a new object that allows us to traverse the (key, value) pairs in sorted order. The new object should support the above operations plus two additional operations, rewind that puts us back to the beginning, and next that returns the next (key, value) pair. Since the new object supports all of the operations of the original search object, we can make the new object inherit the original object's interface. This is an example of interface inheritance.

 

这是针对如何使用继承的争论,特别是,当你想实现接口的时候是否应该使用继承,或者当你想继承实现的时候是否应该使用继承。

例如,你想定义一组key-value形式的搜索对象,并且可以允许通过查找key得到对应的value。更为准确的来说,搜索对象应当支持以下操作:

● 新增:Add(key,value),新增数据到对象

● 删除:Delete(key,value),从对象中删除数据

● 查找:Retrieve(key), 根据key获取对应的value

现在我们又想允许新对象按照排序顺序key-value,可以再原有的基础上新加两个操作,一个是返回对象的第一对数据,另外一个是可以返回当前对象的下一对数据。由于新的对象支持所有的普通搜索对象,所以我们可以说我们继承了普通对象。这就是继承接口的例子。

To give an example of implementation inheritance, suppose that we want to implement the original search object using a binary search tree. The binary search tree probably already has an implementation for these three operations but it may not use these names for the operations. If we wanted to inherit the binary tree's implementation, we would make the search object be a subclass of the binary tree. We could then make the insert, delete, and lookup operations call the appropriate binary tree operations. Of course, we could also scrap our proposed interface and use the names of the binary tree interface instead.

接下来是继承实现的例子,设想我们想实现二叉树的普通搜索对象,二叉搜索树应该有这三种操作(增删查),尽管这些名称可能不会用在操作上。如果实现二叉搜索树,我们可以新建一个搜索对象作为二叉树的子类。我们可以用新增、删除、查找来调用合适的二叉树操作,当然,我们也可以不用我们之前新增的接口,直接用二叉树的名称代替。

Well, remember that an object is supposed to hide its implementation and that it should be interchangeable with other objects that implement the same interface. We can't very well scrap the interface and use the binary tree's interface because that would tie the interface to the binary tree's interface. So we should hold firm on our originally proposed interface. However, there's another problem. By making the search object inherit from the binary tree, we've also made its implementation dependent on the binary tree.

请记得"对象实现对于使用者不透明,而且在继承同一个接口上,实现的对象可进行内部切换"。我们不能废弃这个接口,因为有对应实现二叉树的子类绑定了,所以我们废弃之前,我们得确认我们定义的新对象。当然,这又是另外一个问题了,我们实现了二叉树接口,又继承了这个二叉树

 

Hopefully the above example shows why implementation inheritance may not be a good idea. In general I've found that inheritance should be used only when you want to inherit an interface. If it so happens that the implementation you get can be also be used, well and good. There are other ways to re-use implementation and we will discuss those later in the course.

希望以上的例子可以说明继承实现并不是个什么好主意。一般来说,当你想实现接口的时候,继承应该是唯一的途径。当前了,除非你用继承实现用得特别特别好。这是我们在接下来的文章应该讨论的问题"另外的途径使用复用来实现接口"。

 

Abstract Data Types

Objects provide an ideal mechanism for implementing abstract data types. An abstract data type is:

  1. A type of data, and

  2. A set of operations for manipulating that data.

Examples of abstract data types include stacks, trees, and hash tables. The reason for the word "abstract" is that an abstract data type defines only the set of operations it supports (i.e., its interface). It does not define an implementation. In order to make the data type concrete one must provide an implementation.

An object is a nice implementation vehicle for abstract data types since the data stored by the object can represent the abstract data type's data and the object's interface can represents the abstract data type's set of operations.

抽象数据类型

对象提供了以一种理想的机制来实现抽象数据类型,抽象数据类型:

1、一种数据的类型

2、一系列可以操作数据的功能

抽象数据类型的例子包括栈、树和哈希表,抽象这个单词表明只有这种类型才能定义的功能。(如它的接口)。它并不定义实现的内容,使为了使这种数据类型必须提供实现。

对于抽象数据类型来说,对象是一种很好的实现例子,因为对象可以保存对应抽象数据类型的数据,实现的子类也可以很好地实现接口所定义的操作。

 

Execution Model

One of the original purposes for object languages was to model applications that have multiple objects that may be operating simultaneously. For example, the machines on a factory floor operate simultaneously. In an operating system the various input devices, such as disks, the keyboard, and the mouse, may be operating simultaneously. In a computer game various players, either human or computer-generated, may be operating simultaneously.

 

面向对象语言众多目的之一就是为了使应用可以同时运行多个对象。例如,工厂可以有多个机器在同时运作,操作系统中多个输入设备(硬盘、鼠标、键盘)可以同时运行,电脑游戏中多个玩家、人、电脑合成可以同时在线。

These applications all have something in a common--they do not have a single thread of control. Instead control is distributed throughout the application. At any given moment multiple objects may want to perform some action. Conventional imperative languages like C have trouble modeling this type of application because they have a single thread of control. Object languages solved this problem by making everything an object and having control reside within each object. That is, at any given moment multiple objects could be executing an operation (at least this is the conceptual model--a computer with a sequential processor might simulate this model by interleaving the execution of the operations). Objects would communicate with one another by passing messages. A message is simply an invocation of an operation in another object. For example, an operating system might queue input events arriving from various input devices. Each input device might be represented as an object and the input event queue might be represented as an object. Each time an input device receives an input event, it would invoke the operation on the event queue that adds an input event to the queue.

这些应用都有共同之处--他们不是单一控制的,他们分布在整个应用的生命周期中控制,可以在任意时间内对象可以执行某些操作。传统过程式的C语言在这类型的应用中就会出现异常,因为它是单进程控制的。面向对象语言通过每个对象都有控制权的方法来解决这个问题,所以在程序执行的任意时间对象都能调用对应的操作。(至少这个是概念模型--顺序执行的计算机可以通过交叉控制多个正在执行的对象)。对象之前的通讯通过传递信息,在对象中信息是被对象的对应的操作所调用的,例如,操作系统可能有来自各种各样的输入设备的输入事件队列,每一个输入设备触发的输入事件都可当做为一个对象,每次输入设备收到输入事件的时候,对象都会把这个操作事件添加到操作系统的输入事件队列中。

Smalltalk and Java are two well known examples of this "everything is an object" concept. They are also well suited for modeling distributed responsibility. Unfortunately, not every application needs to have distributed responsibility and that is where these object-oriented languages run into problems. People try to force this model onto applications that are more naturally modeled using a single thread of control. When this happens, programmers, especially programmers learning object-oriented programming, get confused.

SmallTalk和java是两种知名的"一切皆为对象"理论的案例,它们非常适合做分布式责任建模。很可惜的是,并不是每个应用都需要做分布式建模的,同时这也是面向对象语言的存在问题,这个时候有些人就尝试用单进程进行分布式建模,每每此时,这些程序员,或者是正在学习面向对象语言的程序员就感觉很困惑。

 

In this course we will use C++ which has a different execution model. It retains the notion of a central thread of control. Objects provide services to the central thread of control. For example, a stack object provides a stack service. We will primarily use objects to implement abstract data types. Using objects in this way will give us the advantages of data encapsulation and code re-use. Data encapsulation means that the implementation of an object is hidden and hence we can interchange objects with different implementations but the same interface. Code re-use means that we can use the same object in different applications, so we don't have to write the code twice.

在这个课程里面我们将会使用C++的不同的执行模型,它仍然保留着中心进程的概念,并且控制着中心进程。例如,栈对象会提供栈对应的服务,我们主要使用对象来实现抽象数据类型,用这些对象我们具备数据封装和代码复用的优势,数据封装意味着这个对象的实现是不透明的,我们可以通过不同的对象实现同一个接口来内部通信,代码复用意味着我们可以在不同的应用的使用相同的对象,不用重复造轮子。

 

Tips:

在Windows用Telnet模拟Http(Get/Post)操作

1.cmd->telnet(如果没安装到 控制面板->程序->启动或关闭windows功能 下,勾选Telnet客户端安装)

2.open localhost 80(我在本地搭建个Nginx)

3.进入Telnet,输入

GET / HTTP/1.1

Host: localhost

 

4.返回结果

 

Share:

重温计算机组成原理:RISC、CISC(桌面CPU之争)

 

      长期以来,计算机都是通过堆加硬件来提高性能的,这有赖于VLSI(Very Large Scale Integration)超大规模集成电路的稳定发展,Intel 的Gordon Moore 就曾预言,每24个月集成电路上可以容纳的元器件就可以增加一倍,对应的性能也就能增加一倍,这也是著名的摩尔定律。自然而然,在硬件成本越低却能提升性能的前提上,人们肯定用更复杂的指令来在更多的领域有所建树。那个时候的指令集就是CISC(Complexed Instrcution Set Computer)复杂指令集,以Intel 奔腾4为代表的CISC方向,基础指令集多达500-800多条,后面AMD的速龙代表RISC的指令集的少于100条,这两套针对指令系统截然不同的优化方案,展开了最后的桌面CPU之争。

 

       CISC(Complexed Instrcution Set Computer)复杂指令集,由于庞大的计算机指令数,为了不断的向上兼容和专注性能的提升,相应的就需要控制器和电路,同时也会带来功耗。随着流水线的级别越来越大,指令的取指、译码、分析、执行过程就会越来越复杂,不断容易出错,而且带来的功耗也会抵消对应的性能。

 

       RISC(Reduced Instruction Set Computer)精简指令集,我不知道当时为了设计指令系统合理性的 JhomasI.Wason是如何得出28定律的,一个计算机程序中所使用的80%指令,只占了指令系统的20%,指令集只需要使用频率高的20%的指令即可,如果特别的领域需要特别的指令,那么可以通过拓展的方式达到目的。同时,用了哈佛设计的内存模型,"数据"和"指令"隔离开来,后续优化流水线的冒险和预测就不需要兼顾指令和数据的逻辑性了。

        

      Intel在 1999年前,主频一直都是遥遥领先的,那时候我记得家里的电脑CPU就是奔腾4,1999 年,AMD 发布了基于 K7 架构的 Athlon 处理器,其综合性能超越了当年的 Pentium III。2000 年,在大部分 CPU 还在 500~850MHz 的频率下运行的时候,AMD 推出了第一代 Athlon 1000 处理器,成为第一款 1GHz 主频的消费级 CPU。在 2000 年前后,AMD 的 CPU 不但性能和主频比 Intel 的要强,价格还往往只有 Intel 的 2/3,巨大的商业压力下,Intel不得不放弃原来梦想中10GHz的主频梦。

 

 

 

【图像大模型】RIFE实战:如何通过中间流估计实现4K视频的实时插帧优化 本文深入解析了基于深度学习的RIFE视频插帧算法,重点探讨其核心的中间流估计技术如何实现高效精准的帧生成。通过实战教程,详细介绍了针对4K视频的实时处理优化方案,包括环境配置、参数调优及性能瓶颈分析,帮助用户利用消费级显卡将低帧率视频转化为流畅的高帧率体验。 阅读详情

相关推荐

Overleaf+EndNote+BibTeX:手把手搞定Elsevier期刊投稿的参考文献格式(避坑指南)

本文详细介绍了如何利用Overleaf、EndNote和BibTeX三大工具无缝协作,解决Elsevier期刊投稿中的参考文献格式问题。从工具链配置、文献库导出、BibTeX文件优化到Overleaf集成与编译,提供全流程指南和常见问题解决方案,帮助学术新手高效完成Elsevier期刊投稿。

weixin_30616969的博客 512

Flutter中Mixin的一些理解

使用Mixin前先复习一下继承与实现 1.extends +implements abstract class First { void doPrint() { print('First'); } } abstract class Second { void doPrint() { print('Second'); } } class Father { ...

HuberCui的博客 3206

手把手教你用Three.js+Vue打造3D机房可视化系统(附完整代码)

本文详细介绍了如何使用Three.js与Vue 3构建企业级3D机房可视化系统。从技术选型、项目架构设计到3D场景构建、设备建模与渲染策略,提供了完整的开发方案和实战代码。重点讲解了如何实现设备状态实时监控、交互操作与性能优化,帮助开发者快速掌握3D可视化开发的核心技术。

ttt77的博客 319

flutter webrtc 编译报错 Could not build the precompiled application for the device.

flutter webrtc运行报错 Running Xcode build... Xcode build done. 19.7s Failed to build iOS app Error output from Xcode build: ↳ 2022-03-31 15:36:50.750 xcodebuild[10731:312247] Requested but did not find extension p

iOS_MingXing的博客 7904

Arduino IDE 2.3.2 配置 UNO R4 WIFI 开发环境避坑指南(附LED矩阵驱动测试)

本文详细介绍了如何在Arduino IDE 2.3.2中配置UNO R4 WIFI开发环境,并提供了LED矩阵驱动的实战指南。从开发环境搭建到硬件连接,再到LED矩阵的初始化和弹球动画实现,手把手教你避开常见配置陷阱,最终实现流畅的动画效果。特别适合刚接触UNO R4 WIFI的开发者快速上手。

weixin_28675839的博客 220

死区补偿---学习笔记

最近调试中发现,死区补偿对电流谐波和电流带宽影响挺大,于是对死区补偿产生浓厚兴趣,找来几篇文章粗读并做一下笔记。 传统做法 无非就是根据电流方向补偿,假如svpwm计算出的A相理论导通实践为T1,死区时间是Td,则实际导通时间T = T1-Td(when ia >0 ),于是在svpwm计算出的导通时间T1的基础上加上Td。这样经过PWM模块后,实际的导通时间即为T1. 但存在两个难点(个人总结): 1,受电流检测精度影响,尤其是在过零点检测困难。 2,真实的二极管导通需要一定电压,并非..

圆桌骑士的博客 2万+

面向对象软件构造(第2版)-第6章 Abstract data types抽象数据类型 (上)

This opened my mind, I started to grasp what it means to use the tool known as algebra. I’ll be damned if anyone had ever told me before: over and again Mr. Dupuy [the mathematics teacher] was makin

Liber Wang - 我知道的越多,发现我懂得越少 2052

整理并记录几种运算放大器

运算放大器是一种十分常见的电子元器件,最近我在学习运放,以前在学校没有好好的学习,今天在B站看了唐老师讲运算放大器-唐老师讲电赛系列视频教程,记录下所学的,纯当是自己的笔记 学习运放,有两个重要的概念及重要的计算法宝,虚短vp=vn;和虚断ip=in 1反向比例运算电路 Rf可以大于、小于或等于R,起到放大、跟随、衰减输入的作用; 平衡电阻没有太高的精度要求,可加可不加; 有些运放内部集成了补偿电路,就不需要使用平衡电阻,加了反而增大误差,如OPA227 2.同向比例运放电路 .

qq_36823004的博客 6365

[译] 值类型导向编程

原文地址:Value-Oriented Programming 原文作者:MattDiephouse 译文出自:掘金翻译计划 本文永久链接:github.com/xitu/gold-m… 译者:nanjingboy 校对者:Bruce-pac 在 2015 WWDC 大会上,在一个具有影响力的会议(面向协议的 Swift 编程)中,Dave Abrahams 解释了如何用 Swift 的协...

weixin_34301307的博客 187

luks-磁盘加密工具

linux磁盘加密配置工具及步骤详解

zdd56789的博客 121

7.18 GART 与 GPUVM 对比:一颗 GPU 上两套页表的分工

本文横向对比AMD GPU上并存的GART与GPUVM两套页表。GART为内核专用,全局单一,线性单层结构,CPU同步直写;GPUVM为每进程48位地址空间,四级页表,含并发状态机,支持隔离与迁移。二者通过VMID区分,共享GMC硬件与PTE编码,分工互补。

图形/计算GPU的驱动与虚拟化技术分享园地 390

不要用子类!Swift的核心是面向协议

作者:ray1689718授权本站转载。 本篇文章翻译自:IF YOU'RE SUBCLASSING, YOU'RE DOING IT WRONG. 原作者:Hector Matos 原发表日期:2015-07-13 Swift的核心 我们可以通过等式的传递性来理...

chunqingtai2922的博客 221

PX4从放弃到精通(五):PX4中的姿态表示方法及转换关系

文章目录机体坐标系与地理坐标系一、pandas是什么?二、使用步骤1.引入库2.读入数据总结 机体坐标系与地理坐标系 在实际应用中,加速度计的测量轴是由运动平台安装固定此器件的轴向决定的。这些坐标轴就形成了载体坐标系,定义如下: 坐标原点设在载体质心(这样可简化运动方程的推导); y轴指向载体前方,称为横滚轴,横滚角以y轴为起始旋转轴而得到,符合右手定则; x轴与y轴夹角90°,指向载体横向,称为俯仰轴,俯仰角以x轴为起始旋转轴而得到,符合右手定则; z轴与x轴、y轴构成右手笛卡儿坐标系,指向载体垂直方向

超维空间科技的博客 8115

ARTS第一周

ARTS第一周 Algorithm 三数之和 给你一个包含 n 个整数的数组 nums,判断 nums 中是否存在三个元素 a,b,c ,使得 a + b + c = 0 ?请你找出所有满足条件且不重复的三元组。 注意:答案中不可以包含重复的三元组。 示例: 给定数组 nums = [-1, 0, 1, 2, -1, -4], 满足要求的三元组集合为: [ [-1, 0, 1], [-1, -1, 2] ] class Solution { public List<List<Intege

u010397795的博客 227

ssm框架搭建

这个是一个在idea上成功跑起来的ssm框架项目,保存在这里方便以后使用直接下载

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

ARTS 打卡 第一周,初试ARTS

写到这里,本次的内容分享就基本接近尾声,总体来讲用一周的业余时间来分别研究这4件事情,然后在一周的最后做一个总结,这是一个非常不错的方式,而且也可以帮助自己养成正确的学习习惯,尤其是可以帮助初入职场的开发者树立正确的学习观。经过四件事情的逐一完成,可以逐渐提升自己的编程思维,也可以让自己在潜移默化中不断进步成长!让我们下周见!

全沾软贱开发攻城狮 1万+

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

ARTS 第一周

ARTS是什么? Algorithm:每周至少做一个leetcode的算法题; Review:阅读并点评至少一篇英文技术文章; Tip/Techni:学习至少一个技术技巧; Share:分享一篇有观点和思考的技术文章。 Algorithm 26. Remove Duplicates from Sorted Array Given a sorted array nums, remove t...

樱木天亥 580

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

第一周ARTS 打卡

每周完成一个ARTS:(也就是 Algorithm、Review、Tip、Share 简称ARTS) 1.每周至少做一个 leetcode 的算法题 2.阅读并点评至少一篇英文技术文章 3.学习至少一个技术技巧 4.分享一篇有观点和思考的技术文章 Algorithm 1.Two Sum Given an array of integers, returnindicesof the...

750

ARTS 打卡第一周

每周完成一个 ARTS: Algorithm: 每周至少做一个 LeetCode 的算法题 ..

canhaimingyue的博客 509

ARTS第一周打卡

ARTS打卡是陈皓(左耳朵耗子)于2019年在专栏读者发起的打卡挑战,累计吸引4000+人参与,产出了很多优质的内容。2023年8月15日打卡重启,目的是为了聚集一波热爱技术的人,延续好奇、探索、实践、分享的精神。

小陈的博客 644

【ARTS】打卡第一周

每周完成一个ARTS 每周至少做一个 leetcode 的算法题 阅读并点评至少一篇英文技术文章 学习至少一个技术技巧 分享一篇有观点和思考的技术文章。 (也就是 Algorithm、Review、Tip、Share 简称ARTS) Algorithm 283.移动零 给定一个数组 nums,编写一个函数将所有 0 移动到数组的末尾,同时保持非零元素的相对顺序。 https://lee...

weixin_30302609的博客 105

Arts 第一周 20190325

ARTS Algorithm 每周至少做一个 Leetcode 的算法题。主要是为了编程训练和学习。 Review 每周阅读并点评至少一篇英文技术文章。主要是为了学习英文。 Tip 每周学习至少一个技术技巧。主要是为了总结和归纳你在日常工作中所遇到的知识点。 Share 每周分享一篇有观点和思考的技术文章。主要是为了建立你的影响力,能够输出价值观。 Algorithm 给定一个包含 n 个整...

weixin_33882452的博客 94
上一篇: 深入理解C#:查询集合
下一篇: Leetcode:Two Sum
Ken_Li_Lsq
博客等级 码龄14年 22粉丝 61原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值